MCPcopy Create free account
hub / github.com/Mobilecn-UI/nativecn-ui / handleError

Function handleError

packages/cli/src/utils/handle-error.ts:4–17  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

2import { logger } from './logger';
3
4export function handleError(error: unknown) {
5 if (typeof error === 'string') {
6 logger.error(error);
7 process.exit(1);
8 }
9
10 if (error instanceof Error) {
11 logger.error(error.message);
12 process.exit(1);
13 }
14
15 logger.error('Something went wrong. Please try again.');
16 process.exit(1);
17}

Callers 2

init.tsFile · 0.90
add.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected