@mintlify/prebuild
Version:
Helpful functions for Mintlify's prebuild step
11 lines (10 loc) • 558 B
JavaScript
import chalk from 'chalk';
import { getLocationErrString } from './getLocationErrString.js';
export const formatError = (error, filePath, contentDirectoryPath) => {
if (typeof error !== 'object' || error == null) {
return `\n${chalk.red.bold('parsing error')} ${filePath} - ${error}`;
}
const location = getLocationErrString(filePath, contentDirectoryPath, error);
const errorString = 'reason' in error && error.reason != null ? error.reason : error;
return `\n${chalk.red.bold('parsing error')} ${location} - ${errorString}`;
};