Repository navigation
fix(runner): wrap document load failures in DocumentLoadError - #296
Merged
Merged
Conversation
A document the registry could not read or parse escaped as ApiDOM's ResolveError or the parser's ParseError, the only failure outside the ArazzoRunnerError hierarchy. DocumentRegistry.acquire now wraps any non-runner error raised by a provider in the new DocumentLoadError, carrying the canonical URI and the original error as cause. This covers the entry document and source descriptions acquired during a run. Refs #272 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Address the adversarial review of #296: test that a runner error thrown by a provider passes through unwrapped, that an unresolvable reference in a source description is wrapped, and assert uri and cause on the source description case. Document DocumentLoadError on DocumentRegistry.acquire and acquireEntryDocument, and describe it as a read or load failure: a malformed file still has no matching provider and throws UnmatchedProviderError. Refs #272 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Contributor
Author
Adversarial review (lean profile)Run Blockers: none. Suggestions
Nits
Auto-applied fixesCommit ea2bc97:
Runner suite: 702 passing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
DocumentRegistry.acquirenow wraps any error that a provider raises while reading or parsing a document, unless it is already anArazzoRunnerError, in a new publicDocumentLoadError. The new error carries:uri: the canonical URI that failed to load;cause: the original ApiDOMResolveErroror parserParseError.Because every acquisition goes through
acquire, this covers both cases from the issue:ArazzoRunner.load,DocumentRegistry.acquireEntryDocument);Also in this PR:
DocumentLoadErroris exported fromsrc/index.tswith@public.ArazzoRunner.loadlists it in its@throws.ArazzoRunnerError.Motivation and Context
Closes #272
This was the only failure the runner let escape outside its
ArazzoRunnerErrorhierarchy. Now a singleinstanceof ArazzoRunnerErrorcheck covers every way a run can fail to start.Website:
_reference/runner.mdneeds updating after this is released:DocumentLoadErrorrow.DocumentLoadErroron line 340 (acquireEntryDocument) and line 170 (errors list).How Has This Been Tested?
DocumentRegistryspecs: an unreadable entry document and an unreadable source description both throwDocumentLoadError, with the canonicaluriand a non-runnercause. The registry stays usable after the failure.ArazzoRunner.loadspec: an unreadable document rejects with aDocumentLoadErrorthat is also anArazzoRunnerError.cd packages/runner && npm test: 702 passing.typescript:check-types,typescript:declarationandlintare clean.Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests