Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Filipe Sousa 43 posts 205 karma points
    Nov 10, 2020 @ 11:45
    Filipe Sousa
    0

    umbRequestHelper.resourcePromise is never rejected.

    I have the following function:

        save: function (dataFeed) {
            return umbRequestHelper.resourcePromise($http.post(umbRequestHelper.getApiUrl('dataFeedBaseUrl', 'Save'), dataFeed), 'Failed to save API key');
        },
    

    I'm calling it like this:

    dataFeedResource.save(vm.dataFeed).then(function () {
                //Why is this being called when the API fails?
              ...
            }).catch( function () {
                //Why is this not being called when the API fails?
                ...
            });
    

    Even when I return 400 or 500 error from the API, the promise is never rejected, so .catch() is never called. Why is this?

    Many thanks

  • Filipe Sousa 43 posts 205 karma points
    Nov 11, 2020 @ 15:54
    Filipe Sousa
    100

    Solved the mystery. Turns out an interceptor was messing with the response from the API.

Please Sign in or register to post replies

Write your reply to:

Draft