MCPcopy Create free account
hub / github.com/vercel/vercel / printError

Function printError

packages/cli/src/util/error.ts:110–145  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

108}
109
110export function printError(error: unknown) {
111 // Coerce Strings to Error instances
112 if (typeof error === 'string') {
113 error = new Error(error);
114 }
115
116 const apiError = error as APIError;
117 const { message, stack, status, code, sizeLimit } = apiError;
118
119 output.debug(`handling error: ${stack}`);
120
121 if (message === 'User force closed the prompt with 0 null') {
122 return;
123 }
124
125 if (status === 403) {
126 output.error(
127 message ||
128 `Authentication error. Run ${getCommandName('login')} to log-in again.`
129 );
130 } else if (status === 429) {
131 // Rate limited: display the message from the server-side,
132 // which contains more details
133 output.error(message);
134 } else if (code === 'size_limit_exceeded') {
135 output.error(`File size limit exceeded (${bytes(sizeLimit)})`);
136 } else if (message) {
137 output.prettyError(apiError);
138 } else if (status === 500) {
139 output.error('Unexpected server error. Please retry.');
140 } else if (code === 'USER_ABORT') {
141 output.log('Canceled');
142 } else {
143 output.error(`Unexpected error. Please try again later. (${message})`);
144 }
145}

Callers 15

mainFunction · 0.90
mainFunction · 0.90
purgeFunction · 0.90
dangerouslyDeleteFunction · 0.90
invalidateFunction · 0.90
logsFunction · 0.90
index.tsFile · 0.90
mainFunction · 0.90
listCmdFunction · 0.90
updateCmdFunction · 0.90
itemsCmdFunction · 0.90
removeCmdFunction · 0.90

Calls 4

getCommandNameFunction · 0.90
debugMethod · 0.80
errorMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected