Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: let fetch errors bubble up #5

Merged
merged 2 commits into from
May 7, 2024

Conversation

joeybaker
Copy link

♻️ Current situation && 💡 Proposed solution

Fixes #3

Rather than letting the errors from a call to the fetch method get swallowed, we let them throw and let the user decide how to handle them. The code that was there previously seems handy for development, but is atypical for production.

This also leads to more reliable typing by avoiding returning an empty object in the error case.

I don't love copying types out of the @types/tiny-json-http module, but it doesn't expose the types we need and due to type overloading, I wasn't able to extract them with tricks like Parameters or ReturnType.

A cleaner fix would be to modify that module to export what we need, but I've only got so many hours in the day ;)

⚙️ Release Notes

[Consider making this a major release since this is technically a breaking change]

  • [Breaking] Previously, failures from the August/Yale API were logged with console.error. This change removes that behavior and throws an exception to let the library user decide how to handle it.

Fixes donavanbecker#3

Rather than letting the errors from a call to the fetch method get
swallowed, we let them throw and let the user decide how to handle them.
The code that was there previously seems handy for development, but is
atypical for production.

This also leads to more reliable typing by avoiding returning an empty
object in the error case.

I don't love copying types out of the `@types/tiny-json-http` module,
but it doesn't expose the types we need and due to type overloading, I
wasn't able to extract them with tricks like `Parameters` or
`ReturnType`.

A cleaner fix would be to modify that module to export what we need, but
I've only got so many hours in the day ;)
@donavanbecker
Copy link
Owner

Thanks!

@donavanbecker donavanbecker merged commit 4dd277b into donavanbecker:beta-0.3.0 May 7, 2024
1 of 3 checks passed
@joeybaker joeybaker deleted the bubbleerrors branch May 7, 2024 21:13
@donavanbecker
Copy link
Owner

@donavanbecker
Copy link
Owner

@joeybaker can you look into this?

https://github.com/donavanbecker/august-yale/actions/runs/8992331659

nevermind, I fixed this.

@donavanbecker donavanbecker mentioned this pull request May 8, 2024
donavanbecker added a commit that referenced this pull request May 8, 2024
## [1.0.0](https://github.com/donavanbecker/august-yale/tag/v1.0.0) (2024-05-07)

### What's Changed
- Add: concurrent session requests eliminated, Thanks [@joeybaker](https://github.com/joeybakerThanks), [#6](#6)
- Fix: let fetch errors bubble up, Thanks [@joeybaker](https://github.com/joeybakerThanks), [#5](#5)
- Housekeeping and updated dependencies.

**Full Changelog**: v0.2.0...v1.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants