Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
d810ab84
Commit
d810ab84
authored
Apr 27, 2020
by
jackie / Andrea Ida Malkah Klaura
Browse files
add API error handling facility
parent
c53b4541
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/store/handleApiError.js
0 → 100644
View file @
d810ab84
export
default
function
handleApiError
(
vm
,
err
,
message
)
{
if
(
err
.
response
)
{
vm
.
$log
.
error
(
err
.
response
.
status
+
'
'
+
err
.
response
.
statusText
)
vm
.
$log
.
error
(
err
.
response
)
let
msg
=
'
Error:
'
if
(
message
)
{
msg
+=
message
}
msg
+=
'
\n\n
'
msg
+=
'
Status code:
'
+
err
.
response
.
status
+
'
'
+
err
.
response
.
statusText
alert
(
msg
)
}
else
{
vm
.
$log
.
error
(
err
)
if
(
message
)
{
alert
(
'
Error:
'
+
message
+
'
\n
Inspect the console for more details.
'
)
}
else
{
alert
(
'
Unspecified error. Inspect the console for details.
'
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment