( ...input: string[] | [Pick<APIError, 'slug' | 'message' | 'link' | 'action'>] )
| 3 | import renderLink from './link'; |
| 4 | |
| 5 | export default function error( |
| 6 | ...input: string[] | [Pick<APIError, 'slug' | 'message' | 'link' | 'action'>] |
| 7 | ) { |
| 8 | let messages = input; |
| 9 | if (typeof input[0] === 'object') { |
| 10 | const { slug, message, link, action = 'Learn More' } = input[0]; |
| 11 | messages = [message]; |
| 12 | const details = slug ? `https://err.sh/vercel/${slug}` : link; |
| 13 | if (details) { |
| 14 | messages.push(`${chalk.bold(action)}: ${renderLink(details)}`); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | return `${chalk.red('Error:')} ${messages.join('\n')}`; |
| 19 | } |
no test coverage detected