Controlling the Error Loading Page message box

Controlling the Error Loading Page message box

I want to validate whether the approach I am taking with error messages is crazy, or if it's within reason.

My understanding of jquery mobiles page error handling is the following:
jQueryMobile has a default way of notifying the user that a pageload failed. By default it comes up with "Error Loading Page".

The following are the only interactions a developer using jQueryMobile has with these errors.

1) Changing the text/theme in mobile init
  1. $(document).on('mobileinit', function () { 
  2.       $.extend($.mobile, {
  3.             pageLoadErrorMessage: 'blah',
  4.             pageLoadErrorMessageTheme: 'b'
  5.       });
  6. });
2) pageloadfailed event
  1. $(document).on('pageloadfailed', function (event, data) {
  2.       //ok, i know it failed, now what? reject the promise? prompt my own error? change the global error message here?
  3. });
It would seem that there isn't a more convenient way of interacting with the error? Is the expectation in option 2) that you'll change the global error message inside the event? 

I want to change the error message based on the situation, because sometimes I have context information that I want to provide a user which is more than "Sorry, we're having issues" or "Error Loading Page".

The approach I am taking at the moment is this:

  1. $(document).on('pageloadfailed', function (event, data) {
  2.       $.mobile.loading( 'hide' );
  3.       data.deferred.reject( data.absUrl, data.options );
  4.       //do my own thing here, alert with a popup with options
  5. });
It essentially follows what the jquerymobile code does internally anyway, but with my custom error popup instead of the default one. Here's the jqmobile (1.2) code (lines 3741-3753, comments removed):
  1. if ( settings.showLoadMsg ) {
  2.       hideMsg();
  3.       $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, $.mobile.pageLoadErrorMessage, true );
  4.       setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
  5. }
  6. deferred.reject( absUrl, options );
I know there is that "showLoadingMsg" option, but I still want the general ajax loader and i'm not sure there is a way to change this behavior when clicking on a link (seems to only be available when calling #changePage directly).

Anyway, sorry about the long post. But the ultimate goal is to see if what I am doing is reasonable, or totally insane.

Thanks!