Files
ontime/apps/server/src/utils/development.ts
T
2024-10-15 15:51:01 +02:00

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);
}