refactor(Font/model): move baseFontStore and unifiedFontStore to subdirectories, rename errors/index to errors/errors
This commit is contained in:
28
src/entities/Font/lib/errors/errors.ts
Normal file
28
src/entities/Font/lib/errors/errors.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Thrown when the network request to the proxy API fails.
|
||||
* Wraps the underlying fetch error (timeout, DNS failure, connection refused, etc.).
|
||||
*/
|
||||
export class FontNetworkError extends Error {
|
||||
readonly name = 'FontNetworkError';
|
||||
|
||||
constructor(public readonly cause?: unknown) {
|
||||
super('Failed to fetch fonts from proxy API');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown when the proxy API returns a response with an unexpected shape.
|
||||
*
|
||||
* @property field - The name of the field that failed validation (e.g. `'response'`, `'response.fonts'`).
|
||||
* @property received - The actual value received at that field, for debugging.
|
||||
*/
|
||||
export class FontResponseError extends Error {
|
||||
readonly name = 'FontResponseError';
|
||||
|
||||
constructor(
|
||||
public readonly field: string,
|
||||
public readonly received: unknown,
|
||||
) {
|
||||
super(`Invalid proxy API response: ${field}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user