All files exceptions.ts

82.61% Statements 19/23
37.5% Branches 3/8
83.33% Functions 5/6
78.95% Lines 15/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33    6x   1x 1x   1x     1x   1x   1x   6x   6x   1x 1x 1x   6x   6x           6x
import {Model} from "./model";
 
export class NotSavedModelError extends Error {
 
  constructor(public model: Model, public relatedModel: Model) {
    super();
    let relatedModelName: string;
    Iif (relatedModel.constructor.name === "Function") {
      relatedModelName = relatedModel.prototype.constructor.name;
    } else {
      relatedModelName = relatedModel.constructor.name;
    }
    const msg = `(${model.constructor.name}) = ${JSON.stringify(model)}` +
      ` must be saved to establish a relation with (${relatedModelName})`;
    throw new Error(msg);
  }
}
 
export class InvalidPropTypeError extends Error {
  constructor(jsType?: string) {
    super();
    const msg = `Invalid model property type: "${jsType}". Allowed values: ["string, number"]`;
    throw new Error(msg);
  }
}
 
export class InvalidColumnData extends Error {
  constructor(columnData: string | undefined) {
    super();
    const msg = `Invalid column data value: "${columnData}"`;
    throw new Error(msg);
  }
}