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

Feat: add error event #3532

Merged
merged 3 commits into from
Mar 9, 2024
Merged

Feat: add error event #3532

merged 3 commits into from
Mar 9, 2024

Conversation

zachkrall
Copy link
Contributor

Short description

Adds support for wavesurfer.on('error') event. This is helpful when building components where the file source is unknown at build time and you might want to hook into that event to display an error message.

Implementation details

It catches errors thrown by "Fetcher.fetchBlob" and emits it as an event named error

How to test it

yarn test -- --spec ./cypress/e2e/error.cy.js

Screenshots

Checklist

  • This PR is covered by e2e tests
  • It introduces no breaking API changes
    I think it's likely that this introduces a breaking API change if users previously relied on .create throwing an exception which is now caught and reported by .on('error').

src/wavesurfer.ts Outdated Show resolved Hide resolved
Copy link
Owner

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@katspaugh katspaugh changed the title add error event Feat: add error event Feb 5, 2024
@katspaugh
Copy link
Owner

One of the tests seems to be failing on this branch.

@katspaugh katspaugh merged commit e389ed8 into katspaugh:main Mar 9, 2024
1 of 2 checks passed
katspaugh added a commit that referenced this pull request Mar 9, 2024
katspaugh added a commit that referenced this pull request Mar 9, 2024
* Refactor: re-throw error on load

* Media event type

* Rm the blob check added in #3532
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.

2 participants