Skip to content

Commit

Permalink
Fix missing promise catches in s2o cli
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRalphson committed Jan 25, 2018
1 parent 8f4d5fb commit 72bd25b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,8 @@ function convertStr(str, options, callback) {
if (obj) {
options.original = obj;
convertObj(obj, options)
.then(options => resolve(options));
.then(options => resolve(options))
.catch(ex => reject(ex));
}
else {
reject(new Error('Could not parse string'));
Expand All @@ -1365,7 +1366,8 @@ function convertUrl(url, options, callback) {
return res.text();
}).then(function (body) {
convertStr(body, options)
.then(options => resolve(options));
.then(options => resolve(options))
.catch(ex => reject(ex));
}).catch(function (err) {
reject(err);
});
Expand All @@ -1381,7 +1383,8 @@ function convertFile(filename, options, callback) {
else {
options.sourceFile = filename;
convertStr(s, options)
.then(options => resolve(options));
.then(options => resolve(options))
.catch(ex => reject(ex));
}
});
}));
Expand All @@ -1395,7 +1398,8 @@ function convertStream(readable, options, callback) {
})
.on('end', function () {
convertStr(data, options)
.then(options => resolve(options));
.then(options => resolve(options))
.catch(ex => reject(ex));
});
}));
}
Expand Down
10 changes: 10 additions & 0 deletions test/missing-ref/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
openapi: 3.0.0
info:
title: API
version: 1.0.0
paths:
/:
get:
responses:
'200':
description: OK
1 change: 1 addition & 0 deletions test/missing-ref/options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
warnOnly: true
12 changes: 12 additions & 0 deletions test/missing-ref/swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
swagger: 2.0
info:
title: API
version: 1.0.0
paths:
/:
get:
parameters:
- $ref: '#/parameters/notthere'
responses:
'200':
description: OK

0 comments on commit 72bd25b

Please sign in to comment.