Files
agentic-dev/packages/auth/src/entities/errors/auth.ts
Danijel Martinek 9663c82624 fix(errors): set this.name in every domain error constructor (R6)
Spec reviewer caught a systemic gap during Task 6 (navigation) review:
Plan 8 left every feature's domain error class with a constructor that
didn't set this.name = '<ClassName>'. Plan 9 spec R6 requires it.

Fixed across all 10 error files:
- auth: AuthenticationError, UnauthenticatedError, UnauthorizedError, InputParseError
- blog: ArticleNotFoundError, InputParseError
- marketing-pages: PageNotFoundError, InputParseError
- navigation: HeaderNotFoundError, InputParseError
- media: MediaNotFoundError, InputParseError

Functionally a no-op — defineErrorMiddleware uses instanceof, not name —
but ensures correct serialization, stack traces, and JSON inspection.

Refactor log: §7
Spec: R6
2026-05-06 15:33:28 +02:00

21 lines
540 B
TypeScript

export class AuthenticationError extends Error {
constructor(message: string, options?: ErrorOptions) {
super(message, options);
this.name = "AuthenticationError";
}
}
export class UnauthenticatedError extends Error {
constructor(message: string, options?: ErrorOptions) {
super(message, options);
this.name = "UnauthenticatedError";
}
}
export class UnauthorizedError extends Error {
constructor(message: string, options?: ErrorOptions) {
super(message, options);
this.name = "UnauthorizedError";
}
}