The communications platform that puts data protection first.
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.
 
 
 
 
 
Rocket.Chat/server/sdk/errors.ts

22 lines
630 B

export class MeteorError extends Error {
public isClientSafe = true;
public readonly errorType = 'Meteor.Error';
public constructor(public readonly error: string | number, public readonly reason?: string, public readonly details?: any) {
super(String(error));
}
public toJSON(): any {
return {
isClientSafe: this.isClientSafe,
errorType: this.errorType,
error: this.error,
reason: this.reason,
message: `${this.reason} [${this.error}]`,
...(this.details && { details: this.details }),
};
}
}
export const isMeteorError = (error: any): error is MeteorError => error?.errorType === 'Meteor.Error';