@@ -327,7 +327,8 @@ export class AtelierAPI {
327
327
// User likely ran out of licenses
328
328
throw {
329
329
statusCode : response . status ,
330
- message : `The server at ${ host } :${ port } is unavailable. Check License Usage.` ,
330
+ message : response . statusText ,
331
+ errorText : `The server at ${ host } :${ port } is unavailable. Check License Usage.` ,
331
332
} ;
332
333
}
333
334
if ( response . status === 401 ) {
@@ -355,16 +356,17 @@ export class AtelierAPI {
355
356
const buffer = await response . buffer ( ) ;
356
357
357
358
const responseString = buffer . toString ( "utf-8" ) ;
358
- if ( ! responseString . startsWith ( "{" ) ) {
359
- outputConsole ( [ "" , `Non-JSON response to ${ path } ` , ...responseString . split ( "\r\n" ) ] ) ;
359
+ let data : Atelier . Response ;
360
+ try {
361
+ data = JSON . parse ( responseString ) ;
362
+ } catch {
360
363
throw {
361
- statusCode : 500 ,
362
- message : `Non-JSON response to ${ path } request. View 'ObjectScript' channel on OUTPUT tab of Panel for details.` ,
364
+ statusCode : response . status ,
365
+ message : response . statusText ,
366
+ errorText : `Non-JSON response to ${ path } request. Is the web server suppressing detailed errors?` ,
363
367
} ;
364
368
}
365
369
366
- const data : Atelier . Response = JSON . parse ( responseString ) ;
367
-
368
370
// Decode encoded content
369
371
if ( data . result && data . result . enc && data . result . content ) {
370
372
data . result . enc = false ;
0 commit comments