File size: 1,236 Bytes
4e23b01 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import { registerErrorDomain, type ErrorDomain } from '#/_base/errors/codes';
import { Error2, type Error2Options } from '#/_base/errors/errors';
export const WireErrors = {
codes: {
WIRE_UNKNOWN_RECORD: 'wire.unknown_record',
WIRE_MIGRATION_MISSING: 'wire.migration_missing',
RECORDS_WRITE_FAILED: 'records.write_failed',
},
info: {
'wire.unknown_record': {
title: 'Unknown wire record',
retryable: false,
public: true,
action: 'The record was written by a newer version; upgrade or drop it.',
},
'wire.migration_missing': {
title: 'Wire migration missing',
retryable: false,
public: true,
action: 'The wire file predates the supported migration chain; start a new session.',
},
'records.write_failed': {
title: 'Wire journal write failed',
retryable: false,
public: true,
},
},
} as const satisfies ErrorDomain;
registerErrorDomain(WireErrors);
export type WireErrorCode = (typeof WireErrors.codes)[keyof typeof WireErrors.codes];
export class WireError extends Error2 {
constructor(code: WireErrorCode, message: string, options?: Error2Options) {
super(code, message, options);
this.name = 'WireError';
}
}
|