Skip to main content

UnauthorizedError

talawa-apiDocs


talawa-api / libraries/errors/unauthorizedError / UnauthorizedError

Class: UnauthorizedError

Represents an unauthorized error. It extends the ApplicationError class and is used to handle situations where access to a resource is unauthorized.

Extends

Constructors

new UnauthorizedError()

> new UnauthorizedError(message, code, param, metadata): UnauthorizedError

Creates an instance of UnauthorizedError.

Parameters

message: string = "UnauthorizedError"

The error message. Defaults to "UnauthorizedError".

code: null | string = null

The error code. Can be null. Defaults to null.

param: null | string = null

The parameter related to the error. Can be null. Defaults to null.

metadata: Record<any, any> = \{\}

Additional metadata related to the error. Defaults to an empty object.

Returns

UnauthorizedError

Overrides

ApplicationError.constructor

Defined in

src/libraries/errors/unauthorizedError.ts:15

Properties

errors

> errors: InterfaceError[]

An array of errors conforming to the InterfaceError interface

Inherited from

ApplicationError.errors

Defined in

src/libraries/errors/applicationError.ts:21


httpCode

> httpCode: number

The HTTP status code associated with the error

Inherited from

ApplicationError.httpCode

Defined in

src/libraries/errors/applicationError.ts:23


message

> message: string

Inherited from

ApplicationError.message

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077


name

> name: string

Inherited from

ApplicationError.name

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076


stack?

> optional stack: string

Inherited from

ApplicationError.stack

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078


prepareStackTrace()?

> static optional prepareStackTrace: (err, stackTraces) => any

Optional override for formatting stack traces

Parameters

err: Error

stackTraces: CallSite[]

Returns

any

See

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

Inherited from

ApplicationError.prepareStackTrace

Defined in

node_modules/@types/node/globals.d.ts:143


stackTraceLimit

> static stackTraceLimit: number

Inherited from

ApplicationError.stackTraceLimit

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()

> static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

targetObject: object

constructorOpt?: Function

Returns

void

Inherited from

ApplicationError.captureStackTrace

Defined in

node_modules/@types/node/globals.d.ts:136