mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-526: Add convenience callbacks for ignoring or (quietly) warning of REST errors.
This commit is contained in:
		| @@ -91,6 +91,30 @@ angular.module('rest').factory('requestService', ['$injector', | ||||
|         }); | ||||
|     }; | ||||
|  | ||||
|    return service; | ||||
|     /** | ||||
|      * Promise error callback which ignores all rejections due to REST errors, | ||||
|      * but logs all other rejections, such as those due to JavaScript errors. | ||||
|      * This callback should be used in favor of angular.noop in cases where | ||||
|      * a REST response is being handled but REST errors should be ignored. | ||||
|      * | ||||
|      * @constant | ||||
|      * @type Function | ||||
|      */ | ||||
|     service.IGNORE = service.createErrorCallback(angular.noop); | ||||
|  | ||||
|     /** | ||||
|      * Promise error callback which logs all rejections due to REST errors as | ||||
|      * warnings to the browser console, and logs all other rejections as | ||||
|      * errors. This callback should be used in favor of angular.noop or | ||||
|      * @link{IGNORE} if REST errors are simply not expected. | ||||
|      * | ||||
|      * @constant | ||||
|      * @type Function | ||||
|      */ | ||||
|     service.WARN = service.createErrorCallback(function warnRequestFailed(error) { | ||||
|         $log.warn(error.type, error.message || error.translatableMessage); | ||||
|     }); | ||||
|  | ||||
|     return service; | ||||
|  | ||||
| }]); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user