File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,13 @@ export class AwsSDKVersion3 implements Wrapper {
7676 returnValue instanceof Promise &&
7777 args [ 0 ] instanceof exports . InvokeModelCommand
7878 ) {
79+ // Inspect the response after the promise resolves, it won't change the original promise
7980 returnValue . then ( ( response ) => {
80- this . processResponse ( response , agent ) ;
81+ try {
82+ this . processResponse ( response , agent ) ;
83+ } catch {
84+ // If we don't catch these errors, it will result in an unhandled promise rejection!
85+ }
8186 } ) ;
8287 }
8388 }
Original file line number Diff line number Diff line change @@ -59,8 +59,13 @@ export class OpenAI implements Wrapper {
5959 kind : "ai_op" ,
6060 modifyReturnValue : ( args , returnValue , agent ) => {
6161 if ( returnValue instanceof Promise ) {
62+ // Inspect the response after the promise resolves, it won't change the original promise
6263 returnValue . then ( ( response ) => {
63- this . inspectResponse ( agent , response ) ;
64+ try {
65+ this . inspectResponse ( agent , response ) ;
66+ } catch {
67+ // If we don't catch these errors, it will result in an unhandled promise rejection!
68+ }
6469 } ) ;
6570 }
6671
You can’t perform that action at this time.
0 commit comments