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

Static Error

Error: ErrorConstructor

Static message

message: string

Static name

name: string

Static Optional stack

stack: undefined | string

Generated using TypeDoc