Add error handling for callback usage - #43
Open
tarunspandit wants to merge 1 commit into
Open
Conversation
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.
Summary
getJsonandgetHtmlfor both supported call forms.Closes #14.
Compatibility
Existing callback and Promise calls are unchanged. The new callback is the final optional argument:
The original Promise is still returned and still rejects. Attaching an error callback also lets callback only callers observe failures without creating an unhandled rejection.
Verification
npx --yes deno@2.4.3 fmt --checknpx --yes deno@2.4.3 lintnpx --yes deno@2.4.3 task testnpx --yes deno@2.4.3 task npmThe test suite reports 9 passing suites with 39 passing steps, no failures, and 2 live API suites skipped because no test API key was supplied.
Repository environment note
Current master has unrelated compatibility failures under the newest Deno release, including the existing timeout handle typing in
src/utils.tsand newer lint treatment of inline URL imports. The verification above uses Deno 2.4.3, which passes current master and this change.