@@ -9,20 +9,15 @@ var readFile = RSVP.denodeify(fs.readFile);
9
9
var mime = require ( 'mime-types' ) ;
10
10
var joinUriSegments = require ( './util/join-uri-segments' ) ;
11
11
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
+ }
26
21
}
27
22
28
23
module . exports = CoreObject . extend ( {
@@ -37,26 +32,26 @@ module.exports = CoreObject.extend({
37
32
this . _plugin = plugin ;
38
33
39
34
var providedS3Client = plugin . readConfig ( "s3Client" ) ;
40
-
35
+
41
36
42
37
if ( profile && ! providedS3Client ) {
43
38
this . _plugin . log ( "Using AWS profile from config" , { verbose : true } ) ;
44
39
credentials = fromIni ( { profile : profile } ) ;
45
40
}
46
41
47
42
if ( endpoint ) {
48
- this . _plugin . log ( 'Using endpoint from config' , { verbose : true } ) ;
43
+ this . _plugin . log ( 'Using endpoint from config' , { verbose : true } ) ;
49
44
}
50
45
51
46
this . _client = providedS3Client || new S3 ( config ) ;
52
-
47
+
53
48
if ( endpoint ) {
54
49
this . _client . config . endpoint = endpoint ;
55
50
}
56
51
if ( credentials ) {
57
52
this . _client . config . credentials = credentials ;
58
53
}
59
-
54
+
60
55
} ,
61
56
62
57
upload : function ( options ) {
0 commit comments