Home / Class/ ActionError Class — astro Architecture

ActionError Class — astro Architecture

Architecture documentation for the ActionError class in client.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b25f7aa2_e0f4_d431_a5e0_18397089a2ab["ActionError"]
  eb04bc4a_f415_2ce3_c34b_e7ef77fb812f["client.ts"]
  b25f7aa2_e0f4_d431_a5e0_18397089a2ab -->|defined in| eb04bc4a_f415_2ce3_c34b_e7ef77fb812f
  16011807_cc3e_5eac_60e4_43f7c3e63fa4["constructor()"]
  b25f7aa2_e0f4_d431_a5e0_18397089a2ab -->|method| 16011807_cc3e_5eac_60e4_43f7c3e63fa4
  6df736de_70c1_5e69_b28d_376894783349["codeToStatus()"]
  b25f7aa2_e0f4_d431_a5e0_18397089a2ab -->|method| 6df736de_70c1_5e69_b28d_376894783349
  d8ff8fe1_1fbf_603b_d894_3069da9c42ae["statusToCode()"]
  b25f7aa2_e0f4_d431_a5e0_18397089a2ab -->|method| d8ff8fe1_1fbf_603b_d894_3069da9c42ae
  e3aecf4e_cdde_b1e2_a818_1ca7565dbc4b["fromJson()"]
  b25f7aa2_e0f4_d431_a5e0_18397089a2ab -->|method| e3aecf4e_cdde_b1e2_a818_1ca7565dbc4b

Relationship Graph

Source Code

packages/astro/src/actions/runtime/client.ts lines 67–100

export class ActionError<_T extends ErrorInferenceObject = ErrorInferenceObject> extends Error {
	type = 'AstroActionError';
	code: ActionErrorCode = 'INTERNAL_SERVER_ERROR';
	status = 500;

	constructor(params: { message?: string; code: ActionErrorCode; stack?: string }) {
		super(params.message);
		this.code = params.code;
		this.status = ActionError.codeToStatus(params.code);
		if (params.stack) {
			this.stack = params.stack;
		}
	}

	static codeToStatus(code: ActionErrorCode): number {
		return codeToStatusMap[code];
	}

	static statusToCode(status: number): ActionErrorCode {
		return statusToCodeMap[status] ?? 'INTERNAL_SERVER_ERROR';
	}

	static fromJson(body: any) {
		if (isInputError(body)) {
			return new ActionInputError(body.issues);
		}
		if (isActionError(body)) {
			return new ActionError(body);
		}
		return new ActionError({
			code: 'INTERNAL_SERVER_ERROR',
		});
	}
}

Domain

Frequently Asked Questions

What is the ActionError class?
ActionError is a class in the astro codebase, defined in packages/astro/src/actions/runtime/client.ts.
Where is ActionError defined?
ActionError is defined in packages/astro/src/actions/runtime/client.ts at line 67.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free