import chalk from "chalk" ; import { logger } from "../deps" ; import { checkEngineStrict } from "./npm-utils" ; /**
 * Represents an error that doesn't need to be forwarded to Sentry.
 * These are errors that are user-fault, for example:
 * - Using an old version of CLI
 */ export class HandledError extends Error { } param p returns export const handleError = < T > ( p ) => { return p . catch ( ( e ) => { if ( e . message ) { logger . error ( chalk . bold ( chalk . redBright ( "\nPlasmic error: " ) ) + e . message ) ; } if ( checkEngineStrict ( ) ) { process . exit ( 1 ) ; } else if ( e instanceof HandledError ) { process . exit ( 1 ) ; } else { throw e ; } } ) ; } ;