1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8 |
|
9 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
10 |
|
11 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
12 |
|
13 | var MESSAGES = exports.MESSAGES = {
|
14 | ENOENT: 'File or directory not found',
|
15 | NOT_MOTION_APP: 'Unable to run, directory is not a motion app',
|
16 | INVALID_MANIFEST: "There are syntax errors in your '.motion.js' file",
|
17 | ALREADY_MOTION_APP: 'Directory is already a motion app'
|
18 | };
|
19 |
|
20 |
|
21 | var ERROR_CODE = exports.ERROR_CODE = {};
|
22 | var _iteratorNormalCompletion = true;
|
23 | var _didIteratorError = false;
|
24 | var _iteratorError = undefined;
|
25 |
|
26 | try {
|
27 | for (var _iterator = Object.keys(MESSAGES)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
28 | var name = _step.value;
|
29 |
|
30 | ERROR_CODE[name] = name;
|
31 | }
|
32 | } catch (err) {
|
33 | _didIteratorError = true;
|
34 | _iteratorError = err;
|
35 | } finally {
|
36 | try {
|
37 | if (!_iteratorNormalCompletion && _iterator.return) {
|
38 | _iterator.return();
|
39 | }
|
40 | } finally {
|
41 | if (_didIteratorError) {
|
42 | throw _iteratorError;
|
43 | }
|
44 | }
|
45 | }
|
46 |
|
47 | var MotionError = exports.MotionError = function (_Error) {
|
48 | _inherits(MotionError, _Error);
|
49 |
|
50 | function MotionError(code) {
|
51 | _classCallCheck(this, MotionError);
|
52 |
|
53 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(MotionError).call(this, MESSAGES[code]));
|
54 |
|
55 | _this.code = code;
|
56 | _this.motion = true;
|
57 | return _this;
|
58 | }
|
59 |
|
60 | return MotionError;
|
61 | }(Error);
|
62 |
|
\ | No newline at end of file |