Skip to main content
Version: 10.x

TRPCError

Hierarchy

  • Error.TRPCError

Constructors

constructor()

Signature

ts
new TRPCError(opts: object): TRPCError;
ts
new TRPCError(opts: object): TRPCError;

Parameters

NameType
optsobject
opts.cause?unknown
opts.code"PARSE_ERROR" | "BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_SUPPORTED" | "TIMEOUT" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST"
opts.message?string

Returns

TRPCError

Overrides: Error.constructor

Defined in: packages/server/src/error/TRPCError.ts:30

Properties

cause?

Error

Defined in: packages/server/src/error/TRPCError.ts:27

code

Readonly "PARSE_ERROR" | "BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_SUPPORTED" | "TIMEOUT" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST"

Defined in: packages/server/src/error/TRPCError.ts:28

message

string

Inherited from: Error.message

Defined in: node_modules/.pnpm/typescript@4.8.3/node_modules/typescript/lib/lib.es5.d.ts:1041

name

string

Inherited from: Error.name

Defined in: node_modules/.pnpm/typescript@4.8.3/node_modules/typescript/lib/lib.es5.d.ts:1040

stack?

string

Inherited from: Error.stack

Defined in: node_modules/.pnpm/typescript@4.8.3/node_modules/typescript/lib/lib.es5.d.ts:1042

prepareStackTrace?

Function

Type declaration

Optional override for formatting stack traces

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Signature
ts
(err: Error, stackTraces: CallSite[]): any;
ts
(err: Error, stackTraces: CallSite[]): any;
Parameters
NameType
errError
stackTracesCallSite[]
Returns

any

Inherited from: Error.prepareStackTrace

Defined in: node_modules/.pnpm/@types+node@18.7.20/node_modules/@types/node/ts4.8/globals.d.ts:11

stackTraceLimit

Static number

Inherited from: Error.stackTraceLimit

Defined in: node_modules/.pnpm/@types+node@18.7.20/node_modules/@types/node/ts4.8/globals.d.ts:13

Methods

captureStackTrace()

Create .stack property on a target object

Signature

ts
Static captureStackTrace(targetObject: object, constructorOpt?: Function): void;
ts
Static captureStackTrace(targetObject: object, constructorOpt?: Function): void;

Parameters

NameType
targetObjectobject
constructorOpt?Function

Returns

void

Inherited from: Error.captureStackTrace

Defined in: node_modules/.pnpm/@types+node@18.7.20/node_modules/@types/node/ts4.8/globals.d.ts:4