UNPKG

beautiful-error

Version:

💣 Prettify error messages and stacks 💥

21 lines (14 loc) • 488 B
import normalizeException from"normalize-exception"; import{DEFAULT_OPTS}from"./default.js"; import{normalizeOptions}from"./validate.js"; export const getOpts=(error,opts)=>{ try{ return{error,classes:normalizeOptions(opts)} }catch(error_){ error_.message=`${PACKAGE_NAME} invalid usage: ${error_.message}`; const errorA=normalizeException(error_); return{error:errorA,classes:{default:INVALID_OPTS}} } }; const PACKAGE_NAME="beautiful-error"; const INVALID_OPTS={...DEFAULT_OPTS};