Skip to content

Commit

Permalink
Merge pull request #21 from SumitBando/master
Browse files Browse the repository at this point in the history
show failed file location in error message, to aid debugging
  • Loading branch information
aleksandryackovlev authored Mar 8, 2021
2 parents cc23a88 + 0499b7a commit a1fdf61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('createMockMiddleware', () => {
throw new Error('exit');
} catch (error) {
expect(error).toBeInstanceOf(Error);
expect(error).toHaveProperty('message', 'File with the openapi docs does not exist');
expect(error).toHaveProperty('message', 'OpenAPI spec not found at location');
}
});
});
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const createMockMiddleware = ({
jsfCallback,
}: MiddlewareOptions): express.Router => {
if (!fs.existsSync(file)) {
throw new Error('File with the openapi docs does not exist');
throw new Error(`OpenAPI spec not found at location: ${file}`);
}

const router = createRouter();
Expand Down

0 comments on commit a1fdf61

Please sign in to comment.