Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
scc-net
netvs
netvs-core
Commits
82e0dc7a
Commit
82e0dc7a
authored
Nov 19, 2020
by
janis.streib
🦉
Browse files
ADD: generic error-handler
parent
0920c7dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
frontend/src/App.vue
View file @
82e0dc7a
...
...
@@ -24,18 +24,28 @@
<Sidebar/>
</b-card>
</div>
<b-modal
content-class=
"text-center"
centered
id=
"net-suite-error"
hide-footer
hide-header
size=
"lg"
>
<h1><font-awesome-icon
icon=
"poo-storm"
size=
"3x"
></font-awesome-icon></h1>
<h3>
Etwas ist schief gelaufen...
</h3>
<CopyField
class=
"shadow"
variant=
"danger"
:text=
"global_error"
multiline
/>
</b-modal>
</div>
</
template
>
<
script
>
import
Navbar
from
'
./components/Navbar
'
import
CopyField
from
'
./components/CopyField
'
import
Footer
from
'
./components/Footer
'
import
Sidebar
from
'
./components/Sidebar
'
import
{
EventBus
}
from
'
@/eventbus
'
export
default
{
components
:
{
Sidebar
,
Footer
,
Navbar
},
components
:
{
Sidebar
,
Footer
,
Navbar
,
CopyField
},
data
()
{
return
{
global_error
:
null
,
breadcrumbs
:
[]
}
},
...
...
@@ -71,6 +81,13 @@ export default {
},
mounted
()
{
window
.
console
.
log
(
'
%c
'
,
`font-size:0px; padding: 200px; background:url(
${
window
.
location
.
protocol
}
//
${
window
.
location
.
hostname
}
:
${
window
.
location
.
port
}
/important.webp) no-repeat; background-position: center; background-size: contain;`
)
const
self
=
this
EventBus
.
$on
(
'
error
'
,
(
payload
)
=>
{
window
.
console
.
debug
(
'
evbus trigger
'
)
window
.
console
.
debug
(
payload
)
self
.
global_error
=
JSON
.
stringify
(
payload
,
null
,
4
)
this
.
$bvModal
.
show
(
'
net-suite-error
'
)
})
}
}
</
script
>
...
...
frontend/src/eventbus.js
0 → 100644
View file @
82e0dc7a
import
Vue
from
'
vue
'
export
default
{}
export
const
EventBus
=
new
Vue
()
frontend/src/icons.js
View file @
82e0dc7a
...
...
@@ -47,7 +47,8 @@ import {
faMapSigns
,
faNetworkWired
,
faHistory
,
faEthernet
faEthernet
,
faPooStorm
}
from
'
@fortawesome/free-solid-svg-icons
'
import
{
...
...
@@ -115,5 +116,6 @@ library.add(
faMapSigns
,
faNetworkWired
,
faHistory
,
faEthernet
faEthernet
,
faPooStorm
)
frontend/src/main.js
View file @
82e0dc7a
...
...
@@ -16,6 +16,7 @@ import vuexUndoRedo from './mixins/vuex-undo-redo'
import
APIUtil
from
'
./util/apiutil
'
import
WAPITransactionSerice
from
'
./api-services/transaction.service
'
import
LoginService
from
'
@/api-services/login.service
'
import
{
EventBus
}
from
'
@/eventbus
'
Vue
.
use
(
Vuex
)
Vue
.
mixin
(
titleMixin
)
...
...
@@ -46,6 +47,22 @@ async function init() {
this
.
splice
(
to
,
0
,
this
.
splice
(
from
,
1
)[
0
])
return
this
}
if
(
!
(
'
toJSON
'
in
Error
.
prototype
))
{
// eslint-disable-next-line no-extend-native
Object
.
defineProperty
(
Error
.
prototype
,
'
toJSON
'
,
{
value
:
function
()
{
var
alt
=
{}
Object
.
getOwnPropertyNames
(
this
).
forEach
(
function
(
key
)
{
alt
[
key
]
=
this
[
key
]
},
this
)
return
alt
},
configurable
:
true
,
writable
:
true
})
}
const
store
=
new
Vuex
.
Store
({
state
:
{
...
...
@@ -279,11 +296,15 @@ async function init() {
// `info` is a Vue-specific error info, e.g. which lifecycle hook
// the error was found in. Only available in 2.2.0+
// alert(err, info)
window
.
console
.
debug
(
'
vue-error handler triggered
'
)
window
.
console
.
log
(
err
,
info
)
EventBus
.
$emit
(
'
error
'
,
err
)
}
window
.
onerror
=
function
(
message
,
source
,
lineno
,
colno
,
error
)
{
window
.
console
.
debug
(
'
window-error handler triggered
'
)
window
.
console
.
log
(
error
)
EventBus
.
$emit
(
'
error
'
,
error
)
}
Axios
.
interceptors
.
response
.
use
(
function
(
response
)
{
...
...
Write
Preview
Supports
Markdown
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