mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
check for object existence before searching for key on that object
to resolve some console errors in regards to http error handling
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
responseError: function(rejection){
|
responseError: function(rejection){
|
||||||
if( !_.isEmpty(rejection.data.detail) && rejection.data.detail === "Maximum per-user sessions reached"){
|
if( rejection.data && !_.isEmpty(rejection.data.detail) && rejection.data.detail === "Maximum per-user sessions reached"){
|
||||||
$rootScope.sessionTimer.expireSession('session_limit');
|
$rootScope.sessionTimer.expireSession('session_limit');
|
||||||
return $q.reject(rejection);
|
return $q.reject(rejection);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,11 +203,11 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
|
|||||||
$rootScope.sessionTimer.expireSession('idle');
|
$rootScope.sessionTimer.expireSession('idle');
|
||||||
}
|
}
|
||||||
$location.url('/login');
|
$location.url('/login');
|
||||||
} else if (data.non_field_errors) {
|
} else if (data && data.non_field_errors) {
|
||||||
Alert('Error!', data.non_field_errors);
|
Alert('Error!', data.non_field_errors);
|
||||||
} else if (data.detail) {
|
} else if (data && data.detail) {
|
||||||
Alert(defaultMsg.hdr, defaultMsg.msg + ' ' + data.detail);
|
Alert(defaultMsg.hdr, defaultMsg.msg + ' ' + data.detail);
|
||||||
} else if (data.__all__) {
|
} else if (data && data.__all__) {
|
||||||
if (typeof data.__all__ === 'object' && Array.isArray(data.__all__)) {
|
if (typeof data.__all__ === 'object' && Array.isArray(data.__all__)) {
|
||||||
Alert('Error!', data.__all__[0]);
|
Alert('Error!', data.__all__[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user