diff --git a/src/Errors/mode.js b/src/Errors/mode.js new file mode 100644 index 0000000..1b826cb --- /dev/null +++ b/src/Errors/mode.js @@ -0,0 +1,5 @@ +import { ISicElementIDError } from "./isicElementIDError.js"; + +export class InvalidModeError extends Error { + +} \ No newline at end of file diff --git a/src/Pure/format.js b/src/Pure/format.js index 4cc2804..28f88c4 100644 --- a/src/Pure/format.js +++ b/src/Pure/format.js @@ -1,4 +1,6 @@ import Constants from "./constants/constants.js" +import { BaseIndexError } from "../Errors/base.js" + export default class Format { @@ -21,7 +23,7 @@ export default class Format { return "ISic" + padded.slice(0, 6) + "-" + padded.slice(6, 10) } else { - console.error("Invalid base") + throw new BaseIndexError(baseIdx) } } diff --git a/src/SideEffects/status.js b/src/SideEffects/status.js index f67fd53..61c32c3 100644 --- a/src/SideEffects/status.js +++ b/src/SideEffects/status.js @@ -1,9 +1,10 @@ import Attrs from "./attrs.js" import Elems from "./elems.js" +import { InvalidModeError } from "../Errors/mode.js" export default class Status { /** - * @returns {"compression"|"midpoint"|"error"} + * @returns {"compression"|"midpoint"} */ static selectionMode = () => { @@ -13,7 +14,7 @@ export default class Status { return "midpoint" } - console.error("Invalid selection mode") - return "error" + // This should never happen + throw new InvalidModeError(`Invalid selection mode`) } }