Connectum API Reference / @connectum/auth / AuthzDeniedError
Class: AuthzDeniedError ​
Defined in: packages/auth/src/errors.ts:25
Authorization denied error.
Carries server-side details (rule name, required roles/scopes) while exposing only "Access denied" to the client via SanitizableError protocol.
Extends ​
Implements ​
SanitizableError
Constructors ​
Constructor ​
new AuthzDeniedError(
details):AuthzDeniedError
Defined in: packages/auth/src/errors.ts:38
Parameters ​
details ​
Returns ​
AuthzDeniedError
Overrides ​
ConnectError.constructor
Properties ​
authzDetails ​
readonlyauthzDetails:AuthzDeniedDetails
Defined in: packages/auth/src/errors.ts:28
cause ​
cause:
unknown
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:46
The underlying cause of this error, if any. In cases where the actual cause is elided with the error message, the cause is specified here so that we don't leak the underlying error, but instead make it available for logging.
Inherited from ​
ConnectError.cause
clientMessage ​
readonlyclientMessage:"Access denied"="Access denied"
Defined in: packages/auth/src/errors.ts:26
Implementation of ​
SanitizableError.clientMessage
code ​
readonlycode:Code
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:20
The Code for this error.
Inherited from ​
ConnectError.code
details ​
details: (
OutgoingDetail|IncomingDetail)[]
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:32
When an error is parsed from the wire, incoming error details are stored in this property. They can be retrieved using findDetails().
When an error is constructed to be sent over the wire, outgoing error details are stored in this property as well.
Inherited from ​
ConnectError.details
message ​
message:
string
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from ​
ConnectError.message
metadata ​
readonlymetadata:Headers
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:24
A union of response headers and trailers associated with this error.
Inherited from ​
ConnectError.metadata
name ​
name:
string
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:40
Inherited from ​
ConnectError.name
rawMessage ​
readonlyrawMessage:string
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:39
The error message, but without a status code in front.
For example, a new ConnectError("hello", Code.NotFound) will have the message [not found] hello, and the rawMessage hello.
Inherited from ​
ConnectError.rawMessage
ruleName ​
readonlyruleName:string
Defined in: packages/auth/src/errors.ts:27
stack? ​
optionalstack?:string
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from ​
ConnectError.stack
stackTraceLimit ​
staticstackTraceLimit:number
Defined in: node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from ​
ConnectError.stackTraceLimit
Accessors ​
serverDetails ​
Get Signature ​
get serverDetails():
Readonly<Record<string,unknown>>
Defined in: packages/auth/src/errors.ts:30
Returns ​
Readonly<Record<string, unknown>>
Implementation of ​
SanitizableError.serverDetails
Methods ​
findDetails() ​
Call Signature ​
findDetails<
Desc>(desc):MessageShape<Desc>[]
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:84
Retrieve error details from a ConnectError. On the wire, error details are wrapped with google.protobuf.Any, so that a server or middleware can attach arbitrary data to an error. This function decodes the array of error details from the ConnectError object, and returns an array with the decoded messages. Any decoding errors are ignored, and the detail will simply be omitted from the list.
Type Parameters ​
Desc ​
Desc extends DescMessage
Parameters ​
desc ​
Desc
Returns ​
MessageShape<Desc>[]
Inherited from ​
ConnectError.findDetails
Call Signature ​
findDetails(
registry):Message[]
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:85
Retrieve error details from a ConnectError. On the wire, error details are wrapped with google.protobuf.Any, so that a server or middleware can attach arbitrary data to an error. This function decodes the array of error details from the ConnectError object, and returns an array with the decoded messages. Any decoding errors are ignored, and the detail will simply be omitted from the list.
Parameters ​
registry ​
Registry
Returns ​
Message[]
Inherited from ​
ConnectError.findDetails
[hasInstance]() ​
static[hasInstance](v):boolean
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:75
Parameters ​
v ​
unknown
Returns ​
boolean
Inherited from ​
ConnectError.[hasInstance]
captureStackTrace() ​
staticcaptureStackTrace(targetObject,constructorOpt?):void
Defined in: node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters ​
targetObject ​
object
constructorOpt? ​
Function
Returns ​
void
Inherited from ​
ConnectError.captureStackTrace
from() ​
staticfrom(reason,code?):ConnectError
Defined in: node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@connectrpc/connect/dist/esm/connect-error.d.ts:74
Convert any value - typically a caught error into a ConnectError, following these rules:
- If the value is already a ConnectError, return it as is.
- If the value is an AbortError or TimeoutError from the fetch API, return the message of the error with code Canceled.
- For other Errors, return the error message with code Unknown by default.
- For other values, return the values String representation as a message, with the code Unknown by default. The original value will be used for the "cause" property for the new ConnectError.
Parameters ​
reason ​
unknown
code? ​
Code
Returns ​
Inherited from ​
ConnectError.from
isError() ​
staticisError(error):error is Error
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.error.d.ts:23
Indicates whether the argument provided is a built-in Error instance or not.
Parameters ​
error ​
unknown
Returns ​
error is Error
Inherited from ​
ConnectError.isError
prepareStackTrace() ​
staticprepareStackTrace(err,stackTraces):any
Defined in: node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:55
Parameters ​
err ​
Error
stackTraces ​
CallSite[]
Returns ​
any
See ​
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from ​
ConnectError.prepareStackTrace