app/scripts/services/api.js
// helper which displays a generic error or more specific one if we got one
helper which displays a generic error or more specific one if we got one
helper which displays a generic error or more specific one if we got one
function displayError(alertService, data, message) {
          $log.debug('Error Data:', data);
          try {
            if (data.hasOwnProperty('reason')) {
              $log.debug('displayError using data.reason');
              message = data.reason;
            } else if (data.hasOwnProperty('error')) {
              $log.debug('displayError using data.error.message');
              message = data.error.message;
            } else if (data.hasOwnProperty('computeFault')) {
              $log.debug('displayError using data.computeFault.message');
              message = data.computeFault.message;
            } else if (data.hasOwnProperty('badRequest')) {
              $log.debug('displayError using data.badRequest.message');
              message = data.badRequest.message;
            }
          } catch (e) {
            message = undefined;
          }
          if (!angular.isDefined(message)) {
            message = 'An error has occurred (bad response). Please try again.';
          }
          alertService.add('warning', message);
        }
function displayError ( alertService , data , message ) { $log . debug ( 'Error Data:' , data ) ; try { if ( data . hasOwnProperty ( 'reason' ) ) { $log . debug ( 'displayError using data.reason' ) ; message = data . reason ; } else if ( data . hasOwnProperty ( 'error' ) ) { $log . debug ( 'displayError using data.error.message' ) ; message = data . error . message ; } else if ( data . hasOwnProperty ( 'computeFault' ) ) { $log . debug ( 'displayError using data.computeFault.message' ) ; message = data . computeFault . message ; } else if ( data . hasOwnProperty ( 'badRequest' ) ) { $log . debug ( 'displayError using data.badRequest.message' ) ; message = data . badRequest . message ; } } catch ( e ) { message = undefined ; } if ( ! angular . isDefined ( message ) ) { message = 'An error has occurred (bad response). Please try again.' ; } alertService . add ( 'warning' , message ) ; }
helper which displays a generic error or more specific one if we got one
helper which displays a generic error or more specific one if we got one