You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
968 B
34 lines
968 B
|
5 months ago
|
import { CodeError, errCode, moduleSeed, type ErrCode, type ModuleSeed } from '$libs/errs';
|
||
|
|
|
||
|
|
export const SEMA_ERR: ModuleSeed = moduleSeed('sema');
|
||
|
|
export const SEMA_ERR_CONFIG: ErrCode = errCode(SEMA_ERR, 'config');
|
||
|
|
export const SEMA_ERR_INVARIANT: ErrCode = errCode(SEMA_ERR, 'invariant');
|
||
|
|
export const SEMA_ERR_DUPLICATE_CHANNEL: ErrCode = errCode(SEMA_ERR, 'duplicate_channel');
|
||
|
|
|
||
|
|
export class SemaConfigError extends CodeError {
|
||
|
|
constructor(message: string) {
|
||
|
|
super(SEMA_ERR_CONFIG, {
|
||
|
|
message: `[sema] ${message}`
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export class SemaInvariantError extends CodeError {
|
||
|
|
constructor(message: string) {
|
||
|
|
super(SEMA_ERR_INVARIANT, {
|
||
|
|
message: `[sema] ${message}`
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export class SemaDuplicateChannelError extends CodeError {
|
||
|
|
readonly channelId: string;
|
||
|
|
|
||
|
|
constructor(channelId: string) {
|
||
|
|
super(SEMA_ERR_DUPLICATE_CHANNEL, {
|
||
|
|
message: `[sema] channel with id "${channelId}" already registered`
|
||
|
|
});
|
||
|
|
this.channelId = channelId;
|
||
|
|
}
|
||
|
|
}
|