mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -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:
parent
1bbd5fbe0a
commit
ff121a56c1
@ -21,7 +21,7 @@
|
||||
return config;
|
||||
},
|
||||
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');
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
|
||||
@ -203,11 +203,11 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
|
||||
$rootScope.sessionTimer.expireSession('idle');
|
||||
}
|
||||
$location.url('/login');
|
||||
} else if (data.non_field_errors) {
|
||||
} else if (data && 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);
|
||||
} else if (data.__all__) {
|
||||
} else if (data && data.__all__) {
|
||||
if (typeof data.__all__ === 'object' && Array.isArray(data.__all__)) {
|
||||
Alert('Error!', data.__all__[0]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user