Skip to content

Commit

Permalink
Remove zod from xrpc-server error handling (#1631)
Browse files Browse the repository at this point in the history
remove zod from xrpc-server error handling check
  • Loading branch information
dholms authored Sep 19, 2023
1 parent f69c1a7 commit a5a0e4a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/xrpc-server/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,13 @@ export class XRPCError extends Error {
}

export function isHandlerError(v: unknown): v is HandlerError {
return handlerError.safeParse(v).success
return (
!!v &&
typeof v === 'object' &&
typeof v['status'] === 'number' &&
(v['error'] === undefined || typeof v['error'] === 'string') &&
(v['message'] === undefined || typeof v['message'] === 'string')
)
}

export class InvalidRequestError extends XRPCError {
Expand Down

0 comments on commit a5a0e4a

Please sign in to comment.