Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
netvs-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scc-net
netvs
netvs-core
Commits
82e0dc7a
Commit
82e0dc7a
authored
4 years ago
by
Janis Streib
Browse files
Options
Downloads
Patches
Plain Diff
ADD: generic error-handler
parent
0920c7dc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
frontend/src/App.vue
+18
-1
18 additions, 1 deletion
frontend/src/App.vue
frontend/src/eventbus.js
+4
-0
4 additions, 0 deletions
frontend/src/eventbus.js
frontend/src/icons.js
+4
-2
4 additions, 2 deletions
frontend/src/icons.js
frontend/src/main.js
+21
-0
21 additions, 0 deletions
frontend/src/main.js
with
47 additions
and
3 deletions
frontend/src/App.vue
+
18
−
1
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
>
...
...
This diff is collapsed.
Click to expand it.
frontend/src/eventbus.js
0 → 100644
+
4
−
0
View file @
82e0dc7a
import
Vue
from
'
vue
'
export
default
{}
export
const
EventBus
=
new
Vue
()
This diff is collapsed.
Click to expand it.
frontend/src/icons.js
+
4
−
2
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
)
This diff is collapsed.
Click to expand it.
frontend/src/main.js
+
21
−
0
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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment