Skip to content

Commit

Permalink
Error logging improvements for #124
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRalphson committed May 10, 2018
1 parent f6ad52e commit 059c64b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion httpsnippetGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function generate(target, client, data) {
}
catch (ex) {
console.warn('Error generating code sample using httpsnippet for', target, client);
if (data.options.verbose) console.warn(ex.message);
if (data.options.verbose) console.warn(ex);
return '';
}
}
Expand Down
2 changes: 1 addition & 1 deletion openapi3.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function getParameters(data) {
if (param.description === 'undefined') { // yes, the string
param.description = '';
}
if (typeof param.description !== 'undefined') {
if ((typeof param.description !== 'undefined') && (typeof param.description === 'string')) {
param.shortDesc = param.description.split('\n')[0];
if (param.shortDesc !== param.description) data.longDescs = true;
}
Expand Down
13 changes: 9 additions & 4 deletions widdershins.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,17 @@ function doit(s) {
}

converter.convert(api,options,function(err,output){
var outfile = argv.outfile||argv._[1];
if (outfile) {
fs.writeFileSync(path.resolve(outfile),output,'utf8');
if (err) {
console.warn(err);
}
else {
console.log(output);
var outfile = argv.outfile||argv._[1];
if (outfile) {
fs.writeFileSync(path.resolve(outfile),output,'utf8');
}
else {
console.log(output);
}
}
});
}
Expand Down

0 comments on commit 059c64b

Please sign in to comment.