- Added a view to ease integration of JS client lib
This commit is contained in:
1 parent
ef43c7831f
commit
e85925ace7
4 files changed
+37
-3
No files matched your search
@@ -6,6 +6,16 @@ class ErrorHandler
|
||||
if ( "url" in options ) {
|
||||
this.url = options['url'];
|
||||
}
|
||||
else {
|
||||
// throw une erreur ici
|
||||
}
|
||||
|
||||
if ( "apikey" in options ) {
|
||||
this.apikey = options['apikey'];
|
||||
}
|
||||
else {
|
||||
// throw une erreur ici
|
||||
}
|
||||
}
|
||||
|
||||
this.catchError();
|
||||
@@ -13,6 +23,8 @@ class ErrorHandler
|
||||
|
||||
catchError() {
|
||||
window.onerror = function(message, url, line, column, error) {
|
||||
// build l'url ET l'api key ensemble pour créer l'URL de réception de bug
|
||||
|
||||
fetch(this.url ? this.url : window.location.href, {
|
||||
method: "post",
|
||||
headers: {
|
||||
@@ -43,4 +55,12 @@ class ErrorHandler
|
||||
set url(set) {
|
||||
return this._url = set;
|
||||
}
|
||||
|
||||
get apikey() {
|
||||
return this._url;
|
||||
}
|
||||
|
||||
set apikey(set) {
|
||||
return this._url = set;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user