【文件属性】:
文件名称:babel-errors:Babel更好的错误消息
文件大小:3KB
文件格式:ZIP
更新时间:2021-01-31 03:10:04
babel error-handling babel-util BabelJavaScript
巴别错误
Babel的更好错误消息
import createBabelFile from 'babel-file' ;
import { BabelError , prettyError , buildCodeFrameError } from 'babel-errors' ;
const file = createBabelFile ( ... ) ;
let path = file . path ;
let { line , column } = path . loc . start ;
throw prettyError ( createErrorWithLoc ( 'Error at this position' , line , column ) ) ;
throw buildCodeFrameError ( path , 'Error with this Path' ) ;
createErrorWithLoc(message, line, column)
这使您可以将位置信息添加到错误中。
wrapErrorWithCodeFrame(err)
当捕获Babel抛出
【文件预览】:
babel-errors-master
----.gitignore(19B)
----README.md(993B)
----LICENSE(1KB)
----package.json(261B)
----index.js(1KB)
----.flowconfig(39B)
----yarn.lock(237B)