render-error.mjs
21 lines and 2 functions in DrDustinEdwards/prelum, at commit e389900 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| constructor | 8 to 12 | 1 | 100% | OkCRAP 1 | No data: mutation testing has not run on this repo yet |
| errorMessage | 21 to 23 | 2 | 100% | OkCRAP 2 | No data: mutation testing has not run on this repo yet |
Imports
It imports no other module of this repo. Imported by render-conformance.mjs, render-directives.mjs, render-nomath.mjs, render-packs.mjs, render-safe.mjs, render.mjs.
Source
// Its own module so the directive plugins and the renderer throw the one class without importing each other.
export class ContentError extends Error {
/**
* @param {string} file
* @param {string} message
*/
constructor(file, message) {
super(`${file}: ${message}`);
this.name = "ContentError";
this.file = file;
}
}
/**
* The message of a thrown value: an Error's own message, anything else as a string.
*
* @param {unknown} error
* @returns {string}
*/
export function errorMessage(error) {
return error instanceof Error ? error.message : String(error);
}