File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " midjourney-fetch" ,
3
- "version" : " 0.1.3 " ,
3
+ "version" : " 0.1.4 " ,
4
4
"description" : " " ,
5
5
"type" : " module" ,
6
6
"main" : " ./dist/index.js" ,
Original file line number Diff line number Diff line change @@ -96,18 +96,17 @@ export class Midjourney {
96
96
} ,
97
97
} ) ;
98
98
if ( res . status >= 400 ) {
99
+ let message = '' ;
99
100
try {
100
101
const data = await res . json ( ) ;
101
102
if ( this . debugger ) {
102
103
this . log ( 'Interactions failed' , JSON . stringify ( data ) ) ;
103
104
}
104
- if ( data ?. message ) {
105
- throw new Error ( data . message ) ;
106
- }
105
+ message = data ?. message ;
107
106
} catch ( e ) {
108
107
// catch JSON error
109
108
}
110
- throw new Error ( `Interactions failed with ${ res . status } ` ) ;
109
+ throw new Error ( message || `Interactions failed with ${ res . status } ` ) ;
111
110
}
112
111
}
113
112
You can’t perform that action at this time.
0 commit comments