@@ -9,20 +9,15 @@ var readFile = RSVP.denodeify(fs.readFile);
99var mime = require ( 'mime-types' ) ;
1010var joinUriSegments = require ( './util/join-uri-segments' ) ;
1111
12- function headObject ( client , params ) {
13- return new RSVP . Promise ( function ( resolve , reject ) {
14- client . headObject ( params , function ( err , data ) {
15- if ( err && err . code === 'NotFound' ) {
16- return resolve ( ) ;
17- }
18- else if ( err ) {
19- return reject ( err ) ;
20- }
21- else {
22- return resolve ( data ) ;
23- }
24- } ) ;
25- } ) ;
12+ async function headObject ( client , params ) {
13+ try {
14+ return await client . headObject ( params ) ;
15+ } catch ( err ) {
16+ if ( err . name === 'NotFound' ) {
17+ return ;
18+ }
19+ throw err ;
20+ }
2621}
2722
2823module . exports = CoreObject . extend ( {
@@ -37,26 +32,26 @@ module.exports = CoreObject.extend({
3732 this . _plugin = plugin ;
3833
3934 var providedS3Client = plugin . readConfig ( "s3Client" ) ;
40-
35+
4136
4237 if ( profile && ! providedS3Client ) {
4338 this . _plugin . log ( "Using AWS profile from config" , { verbose : true } ) ;
4439 credentials = fromIni ( { profile : profile } ) ;
4540 }
4641
4742 if ( endpoint ) {
48- this . _plugin . log ( 'Using endpoint from config' , { verbose : true } ) ;
43+ this . _plugin . log ( 'Using endpoint from config' , { verbose : true } ) ;
4944 }
5045
5146 this . _client = providedS3Client || new S3 ( config ) ;
52-
47+
5348 if ( endpoint ) {
5449 this . _client . config . endpoint = endpoint ;
5550 }
5651 if ( credentials ) {
5752 this . _client . config . credentials = credentials ;
5853 }
59-
54+
6055 } ,
6156
6257 upload : function ( options ) {
0 commit comments