1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = Object.setPrototypeOf ||
|
4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6 | return function (d, b) {
|
7 | extendStatics(d, b);
|
8 | function __() { this.constructor = d; }
|
9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10 | };
|
11 | })();
|
12 | Object.defineProperty(exports, "__esModule", { value: true });
|
13 | var CSVError = (function (_super) {
|
14 | __extends(CSVError, _super);
|
15 | function CSVError(err, line, extra) {
|
16 | var _this = _super.call(this, "Error: " + err + ". JSON Line number: " + line + (extra ? " near: " + extra : "")) || this;
|
17 | _this.err = err;
|
18 | _this.line = line;
|
19 | _this.extra = extra;
|
20 | _this.name = "CSV Parse Error";
|
21 | return _this;
|
22 | }
|
23 | CSVError.column_mismatched = function (index, extra) {
|
24 | return new CSVError("column_mismatched", index, extra);
|
25 | };
|
26 | CSVError.unclosed_quote = function (index, extra) {
|
27 | return new CSVError("unclosed_quote", index, extra);
|
28 | };
|
29 | CSVError.fromJSON = function (obj) {
|
30 | return new CSVError(obj.err, obj.line, obj.extra);
|
31 | };
|
32 | CSVError.prototype.toJSON = function () {
|
33 | return {
|
34 | err: this.err,
|
35 | line: this.line,
|
36 | extra: this.extra
|
37 | };
|
38 | };
|
39 | return CSVError;
|
40 | }(Error));
|
41 | exports.default = CSVError;
|
42 |
|
\ | No newline at end of file |