Throws a TRPCError derived from the given CircleError's band.
Use this in procedures/middleware that handle a Safe error explicitly:
Safe
const { data, error } = await repo.doThing();if (error) throwTRPCError(error); Copy
const { data, error } = await repo.doThing();if (error) throwTRPCError(error);
For the common case you can instead unwrap() the result and let the error bubble; the errorBandMiddleware will map it automatically.
unwrap()
errorBandMiddleware
Throws a TRPCError derived from the given CircleError's band.
Use this in procedures/middleware that handle a
Safeerror explicitly:For the common case you can instead
unwrap()the result and let the error bubble; theerrorBandMiddlewarewill map it automatically.