File tree 1 file changed +24
-9
lines changed
npm-packages/scenario-runner
1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -61,16 +61,31 @@ async function getProvisionerInfo(
61
61
await fetch ( `${ deploymentUrl } /instance_name` )
62
62
) . text ( ) ;
63
63
64
- const info = await (
65
- await fetch (
66
- `${ provisionHost } /api/deployment/${ deploymentName } /team_and_project` ,
67
- {
68
- headers : {
69
- Authorization : `Bearer ${ accessToken } ` ,
70
- } ,
64
+ const response = await fetch (
65
+ `${ provisionHost } /api/deployment/${ deploymentName } /team_and_project` ,
66
+ {
67
+ headers : {
68
+ Authorization : `Bearer ${ accessToken } ` ,
71
69
} ,
72
- )
73
- ) . json ( ) ;
70
+ } ,
71
+ ) ;
72
+
73
+ if ( ! response . ok ) {
74
+ const responseText = await response . text ( ) ;
75
+ throw new Error (
76
+ `HTTP error ${ response . status } : ${ response . statusText } . Response: ${ responseText } ` ,
77
+ ) ;
78
+ }
79
+
80
+ let info ;
81
+ try {
82
+ info = await response . json ( ) ;
83
+ } catch ( e : unknown ) {
84
+ const responseText = await response . text ( ) ;
85
+ throw new Error (
86
+ `Failed to parse JSON response: ${ e instanceof Error ? e . message : String ( e ) } . Full response: ${ responseText } ` ,
87
+ ) ;
88
+ }
74
89
const deploymentId = info . deploymentId ;
75
90
76
91
return {
You can’t perform that action at this time.
0 commit comments