- Added JS debug lib
This commit is contained in:
parent
3590993925
commit
ef43c7831f
46
asset/negundo/js/debug.js
Normal file
46
asset/negundo/js/debug.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
class ErrorHandler
|
||||||
|
{
|
||||||
|
constructor(options) {
|
||||||
|
if ( options ) {
|
||||||
|
if ( "url" in options ) {
|
||||||
|
this.url = options['url'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.catchError();
|
||||||
|
}
|
||||||
|
|
||||||
|
catchError() {
|
||||||
|
window.onerror = function(message, url, line, column, error) {
|
||||||
|
fetch(this.url ? this.url : window.location.href, {
|
||||||
|
method: "post",
|
||||||
|
headers: {
|
||||||
|
'Accept': "application/json",
|
||||||
|
'Content-Type': "application/json",
|
||||||
|
'User-Agent': "NegundoClient/1.0"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
message: message,
|
||||||
|
url: url,
|
||||||
|
line: line,
|
||||||
|
column: column,
|
||||||
|
stack: error.stack,
|
||||||
|
location: window.location.toString()
|
||||||
|
})
|
||||||
|
}).then( response => response ).then(data => {
|
||||||
|
console.info("Error reported", data);
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
get url() {
|
||||||
|
return this._url;
|
||||||
|
}
|
||||||
|
|
||||||
|
set url(set) {
|
||||||
|
return this._url = set;
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,9 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"definitions" : [
|
"definitions" : [
|
||||||
"meta/negundo.php"
|
"meta/negundo.php"
|
||||||
|
],
|
||||||
|
"config": [
|
||||||
|
"meta/config.php"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
meta/config.php
Normal file
9
meta/config.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'lean' => [
|
||||||
|
'autoload' => [
|
||||||
|
'assets.negundo'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
@ -9,4 +9,15 @@ return [
|
|||||||
NegundoMiddleware::class => autowire(NegundoMiddleware::class),
|
NegundoMiddleware::class => autowire(NegundoMiddleware::class),
|
||||||
Dump::class => autowire(Dump::class),
|
Dump::class => autowire(Dump::class),
|
||||||
Task::class => autowire(Task::class),
|
Task::class => autowire(Task::class),
|
||||||
|
|
||||||
|
'assets.negundo' => [
|
||||||
|
'picea' => [
|
||||||
|
'asset' => [
|
||||||
|
[
|
||||||
|
'path' => implode(DIRECTORY_SEPARATOR, [ dirname(__DIR__), "asset", '' ]),
|
||||||
|
'order' => 10
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user