ds4/src/module/utils.ts

11 lines
327 B
TypeScript
Raw Normal View History

2021-07-23 00:43:15 +02:00
import { getGame } from "./helpers";
export function enforce(value: unknown, message?: string | Error): asserts value {
if (!value) {
if (!message) {
message = getGame().i18n.localize("DS4.ErrorUnexpectedError");
}
throw message instanceof Error ? message : new Error(message);
}
}