Changeset 17


Ignore:
Timestamp:
Feb 28, 2011, 1:49:07 PM (12 years ago)
Author:
robert@…
Message:

Better error handling during synchronization

Location:
trunk/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/nl/tno/metagenomics/integration/SynchronizeController.groovy

    r16 r17  
    3030                } catch( Exception e ) {
    3131                        // Catch all exceptions, show them to the user (by rendering a text message) and print a stacktrace
    32                         log.error "Exception during full synchronization: " + e.getMessage()
     32                        def message = e.getMessage();
     33                        if( !message || message == 'null' )
     34                                message = 'unknown error';
     35               
     36                        // Show errors in log file             
     37                        log.error "Exception during full synchronization: " + message
    3338                        e.printStackTrace()
    3439                       
    35                         render "An error occurred during synchronization (" + e.class?.name + "): " + e.getMessage();
     40                        // Give the user a nice error message
     41                        response.status = 500;
     42                        render "An error occurred during synchronization (" + e.class?.name + "): " + message;
    3643                }
    3744        }
  • trunk/grails-app/views/synchronize/full.gsp

    r16 r17  
    2323                                  success: function(data) { window.location.replace( "${url.encodeAsJavaScript()}" ); },
    2424                                  error: function(xhr, textStatus, errorThrown) {
    25                                         if( confirm( "Error " + xhr.responseCode + ": " + xhr.responseText + ". Would you like to try again?" ) ) {
    26                                                 window.location.refresh();
     25                                        if( confirm( xhr.responseText + ". Please contact the system administrator if the problem persists. Would you like to try again?" ) ) {
     26                                                window.location.reload(true);
    2727                                        } else {
    28                                                 alert( "Redirect to: ${url.encodeAsJavaScript()}" );
     28                                                /*
    2929                                                if( confirm( "Would you like to continue to the original page?") ) {
    3030                                                        window.location.replace( "${url.encodeAsJavaScript()}" );
     
    3232                                                        $( "#wait_dialog").dialog( "close" );
    3333                                                }
     34                                                */
     35                                                $( "#wait_dialog").dialog( "close" );
    3436                                        }                                               
    3537                                  }
Note: See TracChangeset for help on using the changeset viewer.