frontend/.pnpm-store/v3/files/b8/7bc88b03fe8cda28bfcefabb5a1c24ce5f3d9eaa91f2cebb94f6ed6540b47dd3a4388d78da5d5c9e62be9be3ea456fc8320cae698e88504dde793a0a6d1bc6

28 lines
709 B
Plaintext

export default class CSVError extends Error {
static column_mismatched(index: number, extra?: string) {
return new CSVError("column_mismatched", index, extra);
}
static unclosed_quote(index: number, extra?: string) {
return new CSVError("unclosed_quote", index, extra);
}
static fromJSON(obj) {
return new CSVError(obj.err, obj.line, obj.extra);
}
constructor(
public err: string,
public line: number,
public extra?: string
) {
super("Error: " + err + ". JSON Line number: " + line + (extra ? " near: " + extra : ""));
this.name = "CSV Parse Error";
}
toJSON() {
return {
err: this.err,
line: this.line,
extra: this.extra
}
}
}