errors.ts — astro Source File
Architecture documentation for errors.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 244bd8fe_4d6f_01c4_922b_3ce9b01593be["errors.ts"] a2586aae_ce09_613d_4444_659268b61a89["core"] 244bd8fe_4d6f_01c4_922b_3ce9b01593be --> a2586aae_ce09_613d_4444_659268b61a89 style 244bd8fe_4d6f_01c4_922b_3ce9b01593be fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type * as z from 'zod/v4/core';
function formatZodError(error: z.$ZodError): string[] {
return error.issues.map((issue) => ` **${issue.path.join('.')}**: ${issue.message}`);
}
export class LiveCollectionError extends Error {
constructor(
public readonly collection: string,
public readonly message: string,
public readonly cause?: Error,
) {
super(message);
this.name = 'LiveCollectionError';
if (cause?.stack) {
this.stack = cause.stack;
}
}
static is(error: unknown): error is LiveCollectionError {
return error instanceof LiveCollectionError;
}
}
export class LiveEntryNotFoundError extends LiveCollectionError {
constructor(collection: string, entryFilter: string | Record<string, unknown>) {
super(
collection,
`Entry ${collection} → ${typeof entryFilter === 'string' ? entryFilter : JSON.stringify(entryFilter)} was not found.`,
);
this.name = 'LiveEntryNotFoundError';
}
static is(error: unknown): error is LiveEntryNotFoundError {
return (error as any)?.name === 'LiveEntryNotFoundError';
}
}
export class LiveCollectionValidationError extends LiveCollectionError {
constructor(collection: string, entryId: string, error: z.$ZodError) {
super(
collection,
[
`**${collection} → ${entryId}** data does not match the collection schema.\n`,
...formatZodError(error),
'',
].join('\n'),
);
this.name = 'LiveCollectionValidationError';
}
static is(error: unknown): error is LiveCollectionValidationError {
return (error as any)?.name === 'LiveCollectionValidationError';
}
}
export class LiveCollectionCacheHintError extends LiveCollectionError {
constructor(collection: string, entryId: string | undefined, error: z.$ZodError) {
super(
collection,
[
`**${String(collection)}${entryId ? ` → ${String(entryId)}` : ''}** returned an invalid cache hint.\n`,
...formatZodError(error),
'',
].join('\n'),
);
this.name = 'LiveCollectionCacheHintError';
}
static is(error: unknown): error is LiveCollectionCacheHintError {
return (error as any)?.name === 'LiveCollectionCacheHintError';
}
}
Domain
Subdomains
Functions
Classes
Dependencies
- core
Source
Frequently Asked Questions
What does errors.ts do?
errors.ts is a source file in the astro codebase, written in typescript. It belongs to the ContentCollections domain, DataLoaders subdomain.
What functions are defined in errors.ts?
errors.ts defines 1 function(s): formatZodError.
What does errors.ts depend on?
errors.ts imports 1 module(s): core.
Where is errors.ts in the architecture?
errors.ts is located at packages/astro/src/content/loaders/errors.ts (domain: ContentCollections, subdomain: DataLoaders, directory: packages/astro/src/content/loaders).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free