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

promiseError disappeared? #1705

Closed
alexcjohnson opened this issue May 18, 2017 · 3 comments · Fixed by #5878
Closed

promiseError disappeared? #1705

alexcjohnson opened this issue May 18, 2017 · 3 comments · Fixed by #5878

Comments

@alexcjohnson
Copy link
Collaborator

We still call lib.promiseError in lib.syncOrAsync but it has disappeared? What do we want to have happen here?

@rreusser
Copy link
Contributor

Is this similar to fail_test.js?

https://github.com/plotly/plotly.js/blob/master/test/jasmine/assets/fail_test.js

@etpinard
Copy link
Contributor

@jklimke
Copy link

jklimke commented Aug 5, 2021

Hi, this came to my notice as i am receiving constantly warnings when using plotly in an promise based environment. As the promiseError function does not exist anymore, it should not be passed to promises for error handling as this causes a warning

Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]    at Object.push../node_modules/plotly.js/src/lib/index.js.lib.syncOrAsync (http://localhost:3000/packs/js/vendors~._node_modules_plotly.js_src_c-9f52df4a5f1ee8c919dc.chunk.js:3256:38)    at relayout (http://localhost:3000/packs/js/vendors~._node_modules_plotly.js_src_c-9f52df4a5f1ee8c919dc.chunk.js:10431:22)    at Object.push../node_modules/plotly.js/src/registry.js.exports.call (http://localhost:3000/packs/js/vendors~._node_modules_pl-6439151412dfacf8a22d.chunk.js:246:42)    at http://localhost:3000/packs/js/vendors~._node_modules_plotly.js_src_c-9f52df4a5f1ee8c919dc.chunk.js:28740:16

Deleting the line should not have side effects:

.then(undefined, lib.promiseError);

So please change it to the following code an leave error handling to the caller that provided a promise.

lib.syncOrAsync = function(sequence, arg, finalStep) {
    var ret, fni;

    function continueAsync() {
        return lib.syncOrAsync(sequence, arg, finalStep);
    }

    while(sequence.length) {
        fni = sequence.splice(0, 1)[0];
        ret = fni(arg);

        if(ret && ret.then) {
            return ret.then(continueAsync);
        }
    }

    return finalStep && finalStep(arg);
};

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 a pull request may close this issue.

4 participants