rollbar.js
1.04 KB
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
/**
* @param data
* @param status started, succeeded (default), failed, or timed_out
*/
function rollbar(data,title='') {
let pages=getCurrentPages();
let p=pages[pages.length-1];
let body_msg=p.route+'?'+JSON.stringify(p.options);
title=title?title:data.response
let param={
access_token: '83bd2afd09b8402b943cb1894a84ec51',
data:{
body:{
message:{
body:title,
route: body_msg,
},
"request": {
"method": "POST",
"headers": {
// Header names should be formatted like they are in HTTP.
openid: data.openid,
formids: data.formids,
operator: data.operator,
},
"body": data.post_data,
},
exception:data.exception,
context:data.response,
title: title,
},
}
}
wx.request({
url: 'https://api.rollbar.com/api/1/item/',
method: 'POST',
data: param,
header: {
//'content-type': 'application/x-www-form-urlencoded'
},
})
}
export default rollbar;