11import { Client } from "raygun" ;
22import { Context , Handler } from "aws-lambda" ;
3-
4- // TODO: Uncomment when raygun4node 1.1.0 is released
5- // import { runWithBreadcrumbsAsync } from "raygun/build/raygun.breadcrumbs";
3+ import { runWithBreadcrumbsAsync } from "raygun/build/raygun.breadcrumbs" ;
64
75export type AwsHandlerConfig = {
86 client : Client ;
@@ -60,7 +58,7 @@ async function runHandler<TEvent, TResult>(
6058
6159 if ( e instanceof Error ) {
6260 await awsHandlerConfig . client . send ( e , sendParams ) ;
63- } else if ( typeof e === "string" ) {
61+ } else if ( typeof e === "string" ) {
6462 // Wrap string exceptions in Error
6563 await awsHandlerConfig . client . send ( Error ( e ) , sendParams ) ;
6664 } else {
@@ -87,9 +85,8 @@ export function awsHandler<TEvent, TResult>(
8785
8886 return async ( event : TEvent , context : Context ) => {
8987 // Scope breadcrumbs to this handler event
90- // TODO: Uncomment when raygun4node 1.1.0 is released
91- // return runWithBreadcrumbsAsync(() => {
92- return runHandler ( awsHandlerConfig , event , context , asyncHandler ) ;
93- // });
88+ return runWithBreadcrumbsAsync ( ( ) => {
89+ return runHandler ( awsHandlerConfig , event , context , asyncHandler ) ;
90+ } ) ;
9491 } ;
9592}
0 commit comments