Repository navigation
Expand file tree
/
Copy pathraven
More file actions
executable file
·59 lines (50 loc) · 1.37 KB
/
Copy pathraven
File metadata and controls
executable file
·59 lines (50 loc) · 1.37 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env node
var os = require('os');
var raven = require('../');
function usage() {
var path = require('path');
console.log('usage:', path.basename(process.argv[1]), 'test [SENTRY_DSN]'
5F1B
;);
}
if (process.argv[2] !== 'test') {
usage();
process.exit(1);
}
var dsn = process.argv.slice(3).join(' ') || process.env.SENTRY_DSN;
if (!dsn) {
usage();
console.log();
console.log('Error: No configuration detected!');
console.log('You must either pass a DSN to the command or set the SENTRY_DSN environment variable.');
process.exit(1);
}
console.log('Using DSN configuration:');
console.log(' ', dsn);
console.log();
var client = new raven.Client(dsn);
console.log('Sending a test message...');
client.on('logged', function(result) {
console.log('success!');
console.log('Event ID was', client.getIdent(result));
});
client.on('error', function(err) {
console.log('error!');
throw err;
});
try {
test
} catch (ex) {
client.captureException(ex, {
message: 'This is a test message generated using ``raven test``',
level: 'info',
logger: 'sentry.test',
culprit: 'bin:raven at main',
request: {
method: 'GET',
url: 'http://example.com'
},
extra: {
user: process.getuid && process.getuid(),
loadavg: os.loadavg()
}
});
}