-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (28 loc) · 984 Bytes
/
index.js
File metadata and controls
31 lines (28 loc) · 984 Bytes
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
var request = require("request"),
path = require("path");
exports.serviceName = "AlertOps";
exports.author = {
name: "Xinlin Ruan",
email: "xinlinr@alertops.com",
github: "AlertOps",
twitter: "AlertOps"
};
exports.onError = function(error, settings, done) {
request({
url: "https://notify.alertops.com/restapi.svc/POSTAlertV2/generic/"
+ settings.apiKey + "/Errorception/" + settings.sourceName
+ "/subject/id/none/none/webUrl/shortText/LongText/none",
method: "post",
body: JSON.stringify({
subject: "(Errorception) " + error.message,
id: path.basename(error.webUrl),
webUrl: error.webUrl,
shortText: "Error: " + error.message,
LongText: "An Error " + error.message + (error.isFirstOccurrence ? " occurred" : " recurred")
+ " at time: " + error.date
+ " in " + (error.isInline?("an inline script on " + error.page):error.scriptPath)
+ " See " + error.webUrl + " for details"
}),
timeout: 10000
}, done);
}