AstroError Class — astro Architecture
Architecture documentation for the AstroError class in errors.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 9b197c90_9ea4_5f56_4cea_3b2612e63446["AstroError"] 6040eeed_628d_7649_3de3_370870542dad["errors.ts"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|defined in| 6040eeed_628d_7649_3de3_370870542dad 68591a9f_b338_1935_143c_aa116ae1b761["constructor()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| 68591a9f_b338_1935_143c_aa116ae1b761 ceb004d1_659a_dde9_b445_19838e679484["setLocation()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| ceb004d1_659a_dde9_b445_19838e679484 067b78b9_cfe7_d915_e234_9371f29d88fe["setName()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| 067b78b9_cfe7_d915_e234_9371f29d88fe 2cb463e1_678b_a6b7_7fb7_06c4c94ad881["setMessage()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| 2cb463e1_678b_a6b7_7fb7_06c4c94ad881 b4b97069_a9be_7fc2_aa4e_d1d080598039["setHint()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| b4b97069_a9be_7fc2_aa4e_d1d080598039 b8788d9e_7cff_719e_90c1_e5ddec39c34f["setFrame()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| b8788d9e_7cff_719e_90c1_e5ddec39c34f 92e0b06d_86bc_e5c2_4285_7338c115b5ef["is()"] 9b197c90_9ea4_5f56_4cea_3b2612e63446 -->|method| 92e0b06d_86bc_e5c2_4285_7338c115b5ef
Relationship Graph
Source Code
packages/astro/src/core/errors/errors.ts lines 33–79
export class AstroError extends Error {
public loc: ErrorLocation | undefined;
public title: string | undefined;
public hint: string | undefined;
public frame: string | undefined;
type: ErrorTypes = 'AstroError';
constructor(props: ErrorProperties, options?: ErrorOptions) {
const { name, title, message, stack, location, hint, frame } = props;
super(message, options);
this.title = title;
this.name = name;
if (message) this.message = message;
// Only set this if we actually have a stack passed, otherwise uses Error's
this.stack = stack ? stack : this.stack;
this.loc = location;
this.hint = hint;
this.frame = frame;
}
public setLocation(location: ErrorLocation): void {
this.loc = location;
}
public setName(name: string): void {
this.name = name;
}
public setMessage(message: string): void {
this.message = message;
}
public setHint(hint: string): void {
this.hint = hint;
}
public setFrame(source: string, location: ErrorLocation): void {
this.frame = codeFrame(source, location);
}
static is(err: unknown): err is AstroError {
return (err as AstroError)?.type === 'AstroError';
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the AstroError class?
AstroError is a class in the astro codebase, defined in packages/astro/src/core/errors/errors.ts.
Where is AstroError defined?
AstroError is defined in packages/astro/src/core/errors/errors.ts at line 33.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free