Skip to content

Commit

Permalink
Checking message origin in error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Ángel committed Jan 7, 2019
1 parent e896317 commit dfec368
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/services/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export class ErrorHandler {
* @param {*} error
*/
extractMessage(error) {
if ((error || {}).status === -1) return 'Server did not respond';
if ((error || {}).status === -1) {
const isFromAPI = ((error || {}).config || {}).url === '/api/request';
return isFromAPI
? 'Wazuh API don\'t reachable. Reason: timeout.'
: 'Server did not respond';
}
if ((((error || {}).data || {}).errorData || {}).message)
return error.data.errorData.message;
if (((error || {}).errorData || {}).message) return error.errorData.message;
Expand Down

0 comments on commit dfec368

Please sign in to comment.