mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-04 06:58:02 +00:00
21 lines
473 B
TypeScript
21 lines
473 B
TypeScript
import { isProduction } from '../externals.js';
|
|
import { consoleError } from '../utils/console.js';
|
|
|
|
/**
|
|
* Milestone checker for dev environment
|
|
* will terminate process if check returns true
|
|
* Ideally we would like to remove the call to this function on build
|
|
*/
|
|
export function shouldCrashDev(check: boolean, reason: string) {
|
|
if (isProduction) {
|
|
return;
|
|
}
|
|
|
|
if (!check) {
|
|
return;
|
|
}
|
|
|
|
consoleError(new Error(reason).stack ?? '');
|
|
process.exit(2);
|
|
}
|