GUACAMOLE-1384: Ensure all $http error objects are wrapped in Guacamole error objects, even if the relevant request could not be sent.

This commit is contained in:
Michael Jumper
2021-07-20 20:28:29 -07:00
parent a1b4e76ab8
commit 8a57b2037e

View File

@@ -56,6 +56,11 @@ angular.module('rest').factory('requestService', ['$injector',
if (response.data) if (response.data)
throw new Error(response.data); throw new Error(response.data);
// Fall back to a generic internal error if the request couldn't
// even be issued (webapp is down, etc.)
else if ('data' in response)
throw new Error({ message : 'Unknown failure sending HTTP request' });
// The value provided is not actually a response object from // The value provided is not actually a response object from
// the $http service // the $http service
throw response; throw response;