Skip to content

Commit 2971633

Browse files
pderaaijPhil Sturgeon
authored andcommitted
Fix #234, proper error handling (#251)
* Fix #234 - Improves error handling for invalid schemas
1 parent 28d530d commit 2971633

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
### Fixed
9+
- Correct handling of displaying validation and linting errors ([#234])
10+
711
## [0.8.6] - 2018-12-18
812
### Added
913
- `notContain` rulesets can now support pattern matching. ([#208] via [@erunion])

lint.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ const command = async (specFile, cmd) => {
8080
);
8181

8282
validator.validate(spec, buildValidatorOptions(skip, verbose), (err, _options) => {
83-
const { context, lintResults } = _options;
83+
const { context, lintResults, valid } = _options || err.options;
8484

85-
if (err) {
85+
if (err && valid === false) {
8686
console.error(colors.red + 'Specification schema is invalid.' + colors.reset);
8787
console.error(formatSchemaError(err, context));
8888
process.exit(1);

0 commit comments

Comments
 (0)