@@ -8,10 +8,10 @@ function cancel(url, id, auth, agentOptions) {
88 } )
99 . then ( ( response ) => {
1010 const res = JSON . parse ( response ) ;
11- if ( ! res . success ) return reject ( errorHandler ( res . message ) ) ;
11+ if ( ! res . success ) return Promise . reject ( errorHandler ( res . message ) ) ;
1212 return resolve ( res ) ;
1313 } )
14- . catch ( ( err ) => reject ( err ) ) ;
14+ . catch ( ( err ) => Promise . reject ( err ) ) ;
1515}
1616
1717function resend ( url , id , auth , options = { id : null , callback_url : null } , agentOptions ) {
@@ -24,10 +24,10 @@ function resend(url, id, auth, options = { id: null, callback_url: null }, agent
2424 } )
2525 . then ( ( response ) => {
2626 const res = JSON . parse ( response ) ;
27- if ( ! res . success ) return reject ( errorHandler ( res . message ) ) ;
27+ if ( ! res . success ) return Promise . reject ( errorHandler ( res . message ) ) ;
2828 return resolve ( res ) ;
2929 } )
30- . catch ( ( err ) => reject ( err ) ) ;
30+ . catch ( ( err ) => Promise . reject ( err ) ) ;
3131}
3232
3333function testDelete ( url , id , auth , agentOptions ) {
@@ -37,10 +37,10 @@ function testDelete(url, id, auth, agentOptions) {
3737 } )
3838 . then ( ( response ) => {
3939 const res = JSON . parse ( response ) ;
40- if ( ! res . success ) return reject ( errorHandler ( res . message ) ) ;
40+ if ( ! res . success ) return Promise . reject ( errorHandler ( res . message ) ) ;
4141 return resolve ( res ) ;
4242 } )
43- . catch ( ( err ) => reject ( err ) ) ;
43+ . catch ( ( err ) => Promise . reject ( err ) ) ;
4444}
4545
4646function getInfo ( url , id , auth , agentOptions ) {
@@ -50,17 +50,17 @@ function getInfo(url, id, auth, agentOptions) {
5050 } )
5151 . then ( ( response ) => {
5252 const res = JSON . parse ( response ) ;
53- if ( ! res . success ) return reject ( errorHandler ( res . message ) ) ;
53+ if ( ! res . success ) return Promise . reject ( errorHandler ( res . message ) ) ;
5454 return resolve ( res ) ;
5555 } )
56- . catch ( ( err ) => reject ( err ) ) ;
56+ . catch ( ( err ) => Promise . reject ( err ) ) ;
5757}
5858
5959function getFile ( url , id , auth , options = { id : null , thumbnail : null } , agentOptions ) {
6060 const thumbnail = options . thumbnail === undefined ? null : options . thumbnail ;
6161
6262 if ( ! [ 's' , 'l' , null ] . includes ( thumbnail ) ) {
63- return reject ( new Error ( 'ThumbnailSizeInvalid: Must be \'s\', \'l\', or null (default) for full file.' ) ) ;
63+ return Promise . reject ( new Error ( 'ThumbnailSizeInvalid: Must be \'s\', \'l\', or null (default) for full file.' ) ) ;
6464 }
6565
6666 return request
@@ -70,7 +70,7 @@ function getFile(url, id, auth, options = { id: null, thumbnail: null }, agentOp
7070 thumbnail : thumbnail
7171 } )
7272 . then ( ( response ) => resolve ( response ) )
73- . catch ( ( err ) => reject ( err ) ) ;
73+ . catch ( ( err ) => Promise . reject ( err ) ) ;
7474}
7575
7676function deleteFile ( url , id , auth , agentOptions ) {
@@ -80,10 +80,10 @@ function deleteFile(url, id, auth, agentOptions) {
8080 } )
8181 . then ( ( response ) => {
8282 const res = JSON . parse ( response ) ;
83- if ( ! res . success ) return reject ( errorHandler ( res . message ) ) ;
83+ if ( ! res . success ) return Promise . reject ( errorHandler ( res . message ) ) ;
8484 return resolve ( res ) ;
8585 } )
86- . catch ( ( err ) => reject ( err ) ) ;
86+ . catch ( ( err ) => Promise . reject ( err ) ) ;
8787}
8888
8989module . exports = {
0 commit comments