File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed
npm-packages/scenario-runner Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -61,16 +61,31 @@ async function getProvisionerInfo(
6161 await fetch ( `${ deploymentUrl } /instance_name` )
6262 ) . text ( ) ;
6363
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 } ` ,
7169 } ,
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+ }
7489 const deploymentId = info . deploymentId ;
7590
7691 return {
You can’t perform that action at this time.
0 commit comments