Commit 99e5ae10 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'global-ajax-error-handler' into 'master'

Global Ajax error handler

## What does this MR do?
Introduces a new global Ajax error handler to show a flash warning about the error detail of XHR requests which failed with status code 404 and 500

## Are there points in the code the reviewer needs to double check?
Double check the wording.

## Why was this MR needed?
A global solution for the problem in the #17880

## What are the relevant issue numbers?
Fixes #17880 

## Screenshots (if relevant)

For requests failed with 404 - 500 

![Screen_Shot_2016-06-21_at_00.07.26](/uploads/04bb3a5a958c3d21aef4fd12bd3d105a/Screen_Shot_2016-06-21_at_00.07.26.png)

For requests failed with 401

![Screen_Shot_2016-06-21_at_00.08.30](/uploads/25cc885ba388f4c6f4c555fa338e1a63/Screen_Shot_2016-06-21_at_00.08.30.png)

See merge request !4797
parents 1c2e7af6 1898cb03
......@@ -245,6 +245,7 @@ v 8.9.0 (unreleased)
- Filter parameters for request_uri value on instrumented transactions.
- Remove duplicated keys add UNIQUE index to keys fingerprint column
- ExtractsPath get ref_names from repository cache, if not there access git.
- Show a flash warning about the error detail of XHR requests which failed with status code 404 and 500
- Cache user todo counts from TodoService
- Ensure Todos counters doesn't count Todos for projects pending delete
- Add left/right arrows horizontal navigation
......
......@@ -185,6 +185,15 @@ $ ->
else
buttons.enable()
$(document).ajaxError (e, xhrObj, xhrSetting, xhrErrorText) ->
if xhrObj.status is 401
new Flash 'You need to be logged in.', 'alert'
else if xhrObj.status in [ 404, 500 ]
new Flash 'Something went wrong on our end.', 'alert'
# Show/Hide the profile menu when hovering the account box
$('.account-box').hover -> $(@).toggleClass('hover')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment