@beforeyoubid/error-adapter
Advanced tools
Comparing version 1.0.20 to 1.0.21
{ | ||
"name": "@beforeyoubid/error-adapter", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "A module to standardize error handling across the BYB platform", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -70,9 +70,9 @@ # BYB Error Adapter | ||
# Usages | ||
The module caters to the following usage mechanisms: | ||
1. Using `withSentry` higher-order function. | ||
The module caters for the following usage mechanisms: | ||
- Using `withSentry` higher-order function. | ||
- This can be used in confuction with the `formatErrors` function (see below). | ||
- Used to wrap a Lambda handler to capture exceptions as per the `serverless-sentry-lib` library. | ||
2. Using `formatErrors` function to format and capture errors caught by GraphQL. | ||
- Using `formatErrors` function to format and capture errors caught by GraphQL. | ||
- This can be passed into a GraphQL handler function to format and send errors to Sentry. | ||
3. Using `handleErrorSentryOptions` to apply the above rules to your own `Sentry` client. | ||
- Using `handleErrorSentryOptions` to apply the above rules to your own `Sentry` client. | ||
### 1) Using withSentry higher-order function | ||
@@ -92,2 +92,3 @@ **Original Lambda Handler Code**: | ||
import { withSentry } from "@beforeyoubid/error-adapter"; // This helper library | ||
export const handler = withSentry(async (event, context) => { | ||
@@ -103,5 +104,4 @@ console.log("EVENT: \n" + JSON.stringify(event, null, 2)); | ||
import { ApolloServer } from 'apollo-server-lambda'; | ||
import withSentry from 'serverless-sentry-lib'; | ||
import schema from '../graphql'; | ||
import { formatError } from '@beforeyoubid/error-adapter'; | ||
import { formatError, withSentry } from '@beforeyoubid/error-adapter'; | ||
@@ -187,3 +187,3 @@ const server = new ApolloServer({ | ||
import withSentry from 'serverless-sentry-lib'; | ||
import { handleErrorSentryOptions, NotFound } from '@beforeyoubid/error-adapter'; | ||
import { handleErrorSentryOptions NotFound } from '@beforeyoubid/error-adapter'; | ||
@@ -190,0 +190,0 @@ export const cronHandler = withSentry(handleErrorSentryOptions, async (event, context) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31753