index.js 1.0 KB

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