@ask-utils/error-handlers

[![npm version](https://badge.fury.io/js/%40ask-utils%2Ferror-handlers.svg)](https://badge.fury.io/js/%40ask-utils%2Ferror-handlers) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Maintainabi

Usage no npm install needed!

<script type="module">
  import askUtilsErrorHandlers from 'https://cdn.skypack.dev/@ask-utils/error-handlers';
</script>

README

ASK Utils for Error Handler

npm version License: MIT Maintainability Test Coverage Build Status logo

https://ask-utils.dev

Getting started

$ npm i -S @ask-utils/error-handlers

Requirement

You SHOULD set the environment variable in your env (Lambda, Container, etc..)

SENTRY_DNS=YOUR_SENTRY_DNS

Basic Usage

import Alexa from 'ask-sdk'
import { SetErrorTrackerInterceptor, SentryDefaultErrorHandler } from '@ask-utils/error-handlers'

export const handler = Alexa.SkillBuilders.standard()
            .addErrorHandlers(SentryDefaultErrorHandler)
            .addRequestInterceptors(SetErrorTrackerInterceptor)
            .lambda()

Custom Usage

const ErrorHandler = SentryErrorHandlerFactory.init()
        .setHandle((handlerInput, error) => {
          console.log('Stack: %j', error.stack)
          return handlerInput.responseBuilder
            .speak('Sorry I could not understand the meaning. Please tell me again')
            .reprompt('Could you tell me onece more?')
            .getResponse()
        })
        .getHandler()