1
|
// Generated by CoffeeScript 1.7.1
|
2
|
(function() {
|
3
|
var exports, iferr, printerr, throwerr, tiferr,
|
4
|
__slice = [].slice;
|
5
|
|
6
|
iferr = function(fail, succ) {
|
7
|
return function() {
|
8
|
var a, err;
|
9
|
err = arguments[0], a = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
10
|
if (err != null) {
|
11
|
return fail(err);
|
12
|
} else {
|
13
|
return typeof succ === "function" ? succ.apply(null, a) : void 0;
|
14
|
}
|
15
|
};
|
16
|
};
|
17
|
|
18
|
tiferr = function(fail, succ) {
|
19
|
return iferr(fail, function() {
|
20
|
var a, err;
|
21
|
a = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
22
|
try {
|
23
|
return succ.apply(null, a);
|
24
|
} catch (_error) {
|
25
|
err = _error;
|
26
|
return fail(err);
|
27
|
}
|
28
|
});
|
29
|
};
|
30
|
|
31
|
throwerr = iferr.bind(null, function(err) {
|
32
|
throw err;
|
33
|
});
|
34
|
|
35
|
printerr = iferr(function(err) {
|
36
|
return console.error(err.stack || err);
|
37
|
});
|
38
|
|
39
|
module.exports = exports = iferr;
|
40
|
|
41
|
exports.iferr = iferr;
|
42
|
|
43
|
exports.tiferr = tiferr;
|
44
|
|
45
|
exports.throwerr = throwerr;
|
46
|
|
47
|
exports.printerr = printerr;
|
48
|
|
49
|
}).call(this);
|