-
Notifications
You must be signed in to change notification settings - Fork 52
Parser Async should reject the Promise when parsing errors are found #35
Comments
Some users may need even that API representation, which contains errors. That's why we do not reject Promise in this situation. Is it important for you to have Promise rejected in case of API with errors? If yes, we can introduce a special option for this purpose. |
Would that change the high-level Parser API? |
@sichvoge A little bit. There will be a new field in |
ok, I agree with having an option for rejecting promises on errors, to cover all possible scenarios |
What will the rejected promise look like? Rejections should be error instances, but the parser can return multiple errors. An error will errors on a property, or just the first error instance? |
@blakeembrey |
There's nothing formal in JavaScript, but you can just do it yourself. You can also subclass var error = new Error('Invalid RAML')
error.errors = errors // Tada, just document the error type.
return error |
Ok, thanks. So, there will be a message |
@blakeembrey It appears that Error subclassing is not available in typescript 1.4 microsoft/TypeScript#1168. Seems like it remains to write parser errors to some field of the newly created error. |
@KonstantinSviridov I pointed out how you can do it in the comment above. |
For For Where |
Right now, the promise is fulfilled, returning an invalid API representation and clients must call the errors() method to know if there was an error.
The text was updated successfully, but these errors were encountered: