Opened 6 years ago

Last modified 3 years ago

#17624 new feature

ContentPane: add onError() public method for notification of server side errors

Reported by: Ian Phillips Owned by:
Priority: undecided Milestone: 1.15
Component: Dijit Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

If I open a Dialog using the "href" attribute, and the server generates an error (4xx or 5xx response code), the only option I have for presenting that error to the user is the "errorMessage" attribute -- not very flexible.

It would be nice to be able to do this:

var dialog = new Dialog({
    href: uri,
    title: title,
    onError: function(response) {
        if ( response.statusCode < 500 ) /* a 4xx error */ {
            return response.status; // eg, "Bad request"
        } else /* a 5xx error */ {
            return "An unexpected error has occurred";
        }
    }
});

Change History (4)

comment:1 Changed 6 years ago by bill

Actually, Dialog extends ContentPane?, and ContentPane? has an _onError method. So you should be able to setup advice on _onError (aspect.after(dialog, "_onError", ...)). I agree it would be a little nicer if there was a public onError method that you could override.

comment:2 Changed 6 years ago by bill

Summary: Allow dijit/Dialog to handle server side errorsContentPane: add onError() public method for notification of server side errors

comment:3 Changed 4 years ago by dylan

Milestone: tbd1.12

comment:4 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.