File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -442,12 +442,15 @@ class Request extends BaseRequest {
442442 debug ( 'request(%d): query' , IDS . get ( this ) , command )
443443
444444 const req = new tds . Request ( command , err => {
445- // to make sure we handle no-sql errors as well
446- if ( err && ( ! errors . length || ( errors . length && err . message !== errors [ errors . length - 1 ] . message ) ) ) {
447- err = new RequestError ( err , 'EREQUEST' )
448- if ( this . stream ) this . emit ( 'error' , err )
449- errors . push ( err )
450- }
445+ // tedious v15 has started using AggregateErrors to wrap multiple errors into single error objects
446+ ( err ?. errors ? err . errors : [ err ] ) . forEach ( ( e , i , { length } ) => {
447+ // to make sure we handle no-sql errors as well
448+ if ( e && ( ! errors . length || ( errors . length && errors . length >= length && e . message !== errors [ errors . length - length + i ] . message ) ) ) {
449+ e = new RequestError ( e , 'EREQUEST' )
450+ if ( this . stream ) this . emit ( 'error' , e )
451+ errors . push ( e )
452+ }
453+ } )
451454
452455 // process batch outputs
453456 if ( batchHasOutput ) {
You can’t perform that action at this time.
0 commit comments