1 | /**
|
2 | * Indicates that the file could not be rendered. If the `cause` property is
|
3 | * undefined, this error can be considered as a pure 404, otherwise it can be a
|
4 | * 500.
|
5 | */
|
6 | export class NotFoundError extends Error {
|
7 | path: string;
|
8 |
|
9 | constructor(
|
10 | path: string,
|
11 | options?: {
|
12 | cause?: unknown;
|
13 | },
|
14 | ) {
|
15 | if (!options?.cause) {
|
16 | super(`Could lookup file for path \`${path}\``, options);
|
17 | } else {
|
18 | super(
|
19 | `Could lookup file for path \`${path}\`\n\n${options.cause.toString()}`,
|
20 | options,
|
21 | );
|
22 | }
|
23 |
|
24 | this.path = path;
|
25 | }
|
26 | }
|