Skip to content

Commit

Permalink
fix(alita-core): 修复 新建AST标签,没有loc信息,引起的报错
Browse files Browse the repository at this point in the history
affects: @areslabs/alita-core
  • Loading branch information
ykforerlang committed Feb 12, 2020
1 parent 9fcfda3 commit 696087a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/alita-core/src/util/ErrorLogTraverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ function wrapperCatch(ast, func) {
const code = ast.__sourceCode

const loc = args[0].node.loc

if (!loc) {
console.log(`异常信息:\n`.error, e)
throw e
}


const result = codeFrameColumns(code, loc, {
highlightCode: true,
linesAbove: 2,
Expand Down

0 comments on commit 696087a

Please sign in to comment.