InteractionRequiredAuthError class

需要用户交互时引发的错误。

扩展

属性

claims

https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/v4-lts/lib/msal-common/docs/claims-challenge.md

包含令牌请求成功网站所需的额外声明的字符串:将用户重定向到授权页并设置额外的声明 Web API:在发回客户端的 WWW-Authenticate 标头中包含声明,以便它知道使用额外的声明桌面应用程序或浏览器上下文请求令牌: 将令牌以交互方式将应用获取到应用上下文(client_credentials):在 AcquireTokenByClientCredential 请求中包含声明

errorNo

服务器错误号;

timestamp

发生错误的时间

traceId

与错误关联的 TraceId

继承属性

correlationId

与错误关联的 CorrelationId

errorCode

短字符串表示错误

errorMessage

错误详细说明

message
name
platformBrokerError

启用中转站时,MsalNodeRuntime 的默认 PlatformBrokerError

stack
stackTraceLimit

该 Error.stackTraceLimit 性质指定了栈跟踪收集的堆栈帧数(无论是由 new Error().stack 或 Error.captureStackTrace(obj)生成)。

默认值为 10 ,但可以设置为任意有效的JavaScript编号。 变更会影响值变更 后 捕获的任何栈跟踪。

如果设置为非数字值或负数值,堆栈追踪不会捕获任何帧。

subError

描述错误的子类

继承的方法

captureStackTrace(object, Function)

在 上.stack创建一个targetObject属性,访问时返回一个字符串,表示代码中Error.captureStackTrace()被调用的位置。

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

迹的第一行将以 作为前缀 ${myObject.name}: ${myObject.message}。

可选 constructorOpt 参数接受函数。 如果给定,所有以上 constructorOpt帧(包括 constructorOpt)将从生成的栈轨迹中省略。

该 constructorOpt 论证有助于对用户隐藏错误生成的实现细节。 例如:

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();
prepareStackTrace(Error, CallSite[])

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

setCorrelationId(string)

构造函数详细信息

InteractionRequiredAuthError(string, string, string, string, string, string, string, string)

new InteractionRequiredAuthError(errorCode?: string, errorMessage?: string, subError?: string, timestamp?: string, traceId?: string, correlationId?: string, claims?: string, errorNo?: string)

参数

errorCode

string

errorMessage

string

subError

string

timestamp

string

traceId

string

correlationId

string

claims

string

errorNo

string

属性详细信息

claims

https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/v4-lts/lib/msal-common/docs/claims-challenge.md

包含令牌请求成功网站所需的额外声明的字符串:将用户重定向到授权页并设置额外的声明 Web API:在发回客户端的 WWW-Authenticate 标头中包含声明,以便它知道使用额外的声明桌面应用程序或浏览器上下文请求令牌: 将令牌以交互方式将应用获取到应用上下文(client_credentials):在 AcquireTokenByClientCredential 请求中包含声明

claims: string

属性值

string

errorNo

服务器错误号;

errorNo?: string

属性值

string

timestamp

发生错误的时间

timestamp: string

属性值

string

traceId

与错误关联的 TraceId

traceId: string

属性值

string

继承属性详细信息

correlationId

与错误关联的 CorrelationId

correlationId: string

属性值

string

继承自AuthError.correlationId

errorCode

短字符串表示错误

errorCode: string

属性值

string

继承自AuthError.errorCode

errorMessage

错误详细说明

errorMessage: string

属性值

string

继承自AuthError.errorMessage

message

message: string

属性值

string

继承自AuthError.message

name

name: string

属性值

string

继承自AuthError.name

platformBrokerError

启用中转站时,MsalNodeRuntime 的默认 PlatformBrokerError

platformBrokerError?: PlatformBrokerError

属性值

继承自AuthError.platformBrokerError

stack

stack?: string

属性值

string

继承自AuthError.stack

stackTraceLimit

该 Error.stackTraceLimit 性质指定了栈跟踪收集的堆栈帧数(无论是由 new Error().stack 或 Error.captureStackTrace(obj)生成)。

默认值为 10 ,但可以设置为任意有效的JavaScript编号。 变更会影响值变更 后 捕获的任何栈跟踪。

如果设置为非数字值或负数值,堆栈追踪不会捕获任何帧。

static stackTraceLimit: number

属性值

number

继承自AuthError.stackTraceLimit

subError

描述错误的子类

subError: string

属性值

string

继承自AuthError.subError

继承的方法详细信息

captureStackTrace(object, Function)

在 上.stack创建一个targetObject属性,访问时返回一个字符串,表示代码中Error.captureStackTrace()被调用的位置。

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

迹的第一行将以 作为前缀 ${myObject.name}: ${myObject.message}。

可选 constructorOpt 参数接受函数。 如果给定,所有以上 constructorOpt帧(包括 constructorOpt)将从生成的栈轨迹中省略。

该 constructorOpt 论证有助于对用户隐藏错误生成的实现细节。 例如:

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();
static function captureStackTrace(targetObject: object, constructorOpt?: Function)

参数

targetObject

object

constructorOpt

Function

继承自AuthError.captureStackTrace

prepareStackTrace(Error, CallSite[])

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

static function prepareStackTrace(err: Error, stackTraces: CallSite[]): any

参数

err

Error

stackTraces

CallSite[]

返回

any

继承自AuthError.prepareStackTrace

setCorrelationId(string)

function setCorrelationId(correlationId: string)

参数

correlationId

string

继承自AuthError.setCorrelationId