-
Notifications
You must be signed in to change notification settings - Fork 7
/
GRCRT.f.errReporter.js
55 lines (54 loc) · 1.59 KB
/
GRCRT.f.errReporter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function grcrtErrReporter(err){
function sendErr(){
// console.log(_json)
var __form = $('<form/>', {
'action' : RepConv.grcrt_domain+'scripts/errorLog.php?_='+Timestamp.server(),
'method' : 'post',
'target' : 'GRCRTErrorSender'
})
.append($('<textarea/>',{'name': '_json'})
.text(
JSON.stringify(_json)
)
);
$('#GRCRTErrorSenderTMP').html('').append(__form);
__form.submit();
}
var _json = {
world : Game.world_id,
time : (new Date()).toISOString(),
userId : Game.player_id,
version : RepConv.Scripts_version,
browser : navigator.userAgent,
error : {
message : err.message,
stack : err.stack
}
}
if($('#GRCRTErrorSender').length == 0){
$('body').append($('<iframe/>',{'id':'GRCRTErrorSender','name':'GRCRTErrorSender','style':'display:none'}));
$('body').append($('<div/>',{'id':'GRCRTErrorSenderTMP'}).hide());
}
// console.log(_json)
// console.log(JSON.stringify(_json))
if(err.silent){
sendErr()
} else {
// console.log(_json);
if(typeof Layout == "object" && typeof Layout.showConfirmDialog == "function"){
console.log(_json);
Layout.showConfirmDialog(
"GRCRTools oops!",
'<div><img src="'+RepConv.grcrt_cdn+'img/octopus.png" style="float:left;padding-right: 10px"/><p style="padding:5px"><b>Found error</b><br/><pre>'+err+'</pre><br/>You want send?</p></div>',
function(){
// console.log(_json)
sendErr()
}
)
} else {
setTimeout(function(){
grcrtErrReporter(err);
},500);
}
}
}