mirror of
https://github.com/ente-io/ente.git
synced 2025-05-24 03:59:22 +00:00
16 lines
462 B
TypeScript
16 lines
462 B
TypeScript
import { isDevBuild } from "./env";
|
|
import log from "./log";
|
|
|
|
/**
|
|
* If running in a dev build, throw an exception with the given message.
|
|
* Otherwise log it as a warning.
|
|
*
|
|
* @param message An optional message to use for the failure. If not provided,
|
|
* then a generic one is used.
|
|
*/
|
|
export const assertionFailed = (message?: string) => {
|
|
message = message ?? "Assertion failed";
|
|
if (isDevBuild) throw new Error(message);
|
|
log.warn(message);
|
|
};
|