File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ export default class JiraApi {
303303
304304 return response ;
305305 } catch ( e ) {
306- throw new Error ( e ) ;
306+ throw new Error ( JSON . stringify ( e ) ) ;
307307 }
308308 }
309309
Original file line number Diff line number Diff line change @@ -299,35 +299,34 @@ describe('Jira API Tests', () => {
299299 it ( 'doRequest throws an error properly' , async ( ) => {
300300 // eslint-disable-next-line no-underscore-dangle
301301 const revert = JiraApi . __set__ ( '_request' , ( uri , options , callback ) => {
302- callback ( undefined , {
303- body : {
302+ callback ( {
303+ body : JSON . stringify ( {
304304 errorMessages : [ 'some error to throw' ] ,
305- } ,
305+ } ) ,
306306 } ) ;
307307 } ) ;
308308
309309 const jira = new JiraApi ( getOptions ( ) ) ;
310310
311311 await jira . doRequest ( { } )
312- . should . eventually . be . rejectedWith ( 'some error to throw' ) ;
312+ . should . eventually . be . rejectedWith ( '{"body":"{\\"errorMessages\\":[\\" some error to throw\\"]}"} ' ) ;
313313
314314 revert ( ) ;
315315 } ) ;
316316
317317 it ( 'doRequest throws a list of errors properly' , async ( ) => {
318318 // eslint-disable-next-line no-underscore-dangle
319319 const revert = JiraApi . __set__ ( '_request' , ( uri , options , callback ) => {
320- callback ( undefined , {
321- body : {
322- errorMessages : [ 'some error to throw' , 'another error' ] ,
323- } ,
320+ callback ( {
321+ body :
322+ JSON . stringify ( { errorMessages : [ 'some error to throw' , 'another error' ] } ) ,
324323 } ) ;
325324 } ) ;
326325
327326 const jira = new JiraApi ( getOptions ( ) ) ;
328327
329328 await jira . doRequest ( { } )
330- . should . eventually . be . rejectedWith ( 'some error to throw, another error' ) ;
329+ . should . eventually . be . rejectedWith ( '{"body":"{\\"errorMessages\\":[\\" some error to throw\\",\\" another error\\"]}"} ' ) ;
331330
332331 revert ( ) ;
333332 } ) ;
You can’t perform that action at this time.
0 commit comments