Skip to content

Commit

Permalink
Better describing errors (#208)
Browse files Browse the repository at this point in the history
Co-authored-by: Allison <[email protected]>
  • Loading branch information
allisonverdam and Allison authored Sep 25, 2020
1 parent f508180 commit e42c894
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ const finalizeSpecificationObject = require('./helpers/finalizeSpecificationObje
* @requires swagger-parser
*/
module.exports = (options) => {
if ((!options.swaggerDefinition || !options.definition) && !options.apis) {
throw new Error('Provided options are incorrect.');
if (!options.swaggerDefinition && !options.definition) {
throw new Error(
'Provided swaggerDefinition or definition attributes are incorrect.'
);
} else if (!options.apis) {
throw new Error('Provided apis attribute are incorrect.');
}

try {
Expand Down

0 comments on commit e42c894

Please sign in to comment.