mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-10 07:07:23 +00:00
23 lines
459 B
TypeScript
23 lines
459 B
TypeScript
export interface IRpcError {
|
|
message: string;
|
|
status?: number;
|
|
}
|
|
|
|
export class CustomRpcException {
|
|
private readonly rpcError: IRpcError;
|
|
|
|
constructor(exception: any) {
|
|
this.rpcError =
|
|
(exception.rpcError as IRpcError) || // propagate RPC error if any
|
|
({
|
|
message: exception.message,
|
|
status: exception.status,
|
|
} as IRpcError);
|
|
}
|
|
|
|
// for testing
|
|
public getError(): IRpcError {
|
|
return this.rpcError;
|
|
}
|
|
}
|