diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-10 18:10:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-10 18:10:12 +0300 |
commit | 8f143a46faf2e7b594301512757edf372c294a0c (patch) | |
tree | 8bd5957ffa44d028905ab51a7252cce6783d2e25 /app/assets/javascripts/jobs | |
parent | 3e06afc4cd1b75b3e957e8debf5e4f1963ba18e0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jobs')
-rw-r--r-- | app/assets/javascripts/jobs/store/actions.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/assets/javascripts/jobs/store/actions.js b/app/assets/javascripts/jobs/store/actions.js index f8156dc2441..04c2e6653d8 100644 --- a/app/assets/javascripts/jobs/store/actions.js +++ b/app/assets/javascripts/jobs/store/actions.js @@ -13,6 +13,7 @@ import { scrollDown, scrollUp, } from '~/lib/utils/scroll_utils'; +import httpStatusCodes from '~/lib/utils/http_status'; export const init = ({ dispatch }, { endpoint, logState, pagePath }) => { dispatch('setJobEndpoint', endpoint); @@ -187,7 +188,11 @@ export const fetchTrace = ({ dispatch, state }) => dispatch('startPollingTrace'); } }) - .catch(() => dispatch('receiveTraceError')); + .catch(e => + e.response.status === httpStatusCodes.FORBIDDEN + ? dispatch('receiveTraceUnauthorizedError') + : dispatch('receiveTraceError'), + ); export const startPollingTrace = ({ dispatch, commit }) => { const traceTimeout = setTimeout(() => { @@ -209,6 +214,10 @@ export const receiveTraceError = ({ dispatch }) => { dispatch('stopPollingTrace'); flash(__('An error occurred while fetching the job log.')); }; +export const receiveTraceUnauthorizedError = ({ dispatch }) => { + dispatch('stopPollingTrace'); + flash(__('The current user is not authorized to access the job log.')); +}; /** * When the user clicks a collapsible line in the job * log, we commit a mutation to update the state |