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

Add error handling to getSeekableBlob #515

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

orthatg
Copy link

@orthatg orthatg commented May 9, 2019

Previously, if getSeekableBlob had any type of error with the fileReader, or with EBML decoding, the error was uncaught and would never proceed to calling the callback.

Now, if it encounters an error, the error is caught and the callback is called with a null result callback(null), allowing the developer's code to respond to the failure instead of halting execution. For example:

getSeekableBlob(blob, myCallback);

function myCallback(result) {
    if (!result) {
        // handle error; alert user that there was a problem
    }
    else {
        // do success handling
    }

Alternatively, making this a Promise and calling reject(error) could be useful, but I felt was out of scope.

orthatg and others added 3 commits May 9, 2019 09:27
If an error occurs during EMBL decoding, the function will no longer fail. Now errors are caught and the callback will always be called.
@mustafaekim
Copy link

I didn't understand how error handling works for this function.

I am getting an error (unrepresentable length ...) on the underlying library (EMBL) but I cannot catch this error. Because I cannot catch, I cannot make the app works in case of error. What can I do ?

@eshajoshi
Copy link

Hey @thijstriemstra , are you able to merge this PR into the codebase? Or, is there someone else with write access who are merge this in?

@thijstriemstra
Copy link
Contributor

i'm not a maintainer of this library.

@eshajoshi
Copy link

Hey @mustafaekim , are you able to merge this into the codebase?

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

4 participants