Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UnauthorizedError

Throw an UnauthorizedError in an intent handler to make the library respond with a HTTP 401 Status Code.

example
const app = dialogflow()

// If using Actions SDK:
// const app = actionssdk()

app.intent('intent', conv => {
  // ...

  // given a function to check if a user auth is still valid
  const valid = checkUserAuthValid(conv)
  if (!valid) {
    throw new UnauthorizedError()
  }

  // ...
})
example
const app = dialogflow()

// If using Actions SDK:
// const app = actionssdk()

app.intent('intent', conv => {
  // ...

  // given a function to check if a user auth is still valid
  const valid = checkUserAuthValid(conv)
  if (!valid) {
    throw new UnauthorizedError()
  }

  // ...
})

Hierarchy

  • Error
    • UnauthorizedError

Properties

Properties

message

message: string

name

name: string

Optional stack

stack: undefined | string

Static Error

Error: ErrorConstructor

Generated using TypeDoc