File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,16 @@ export class Lexer {
44
44
this . _code = code . trim ( )
45
45
this . _isClass = options . isClass ?? false
46
46
this . _ignoredKeys = options . ignoredKeys ?? [ ]
47
- this . _ast = Parser . parse ( code , {
48
- ecmaVersion : 'latest' ,
49
- sourceType : 'module' ,
50
- // Will interpret code inside an async function so return is allowed
51
- allowReturnOutsideFunction : true ,
52
- } )
47
+ try {
48
+ this . _ast = Parser . parse ( code , {
49
+ ecmaVersion : 'latest' ,
50
+ sourceType : 'module' ,
51
+ // Will interpret code inside an async function so return is allowed
52
+ allowReturnOutsideFunction : true ,
53
+ } )
54
+ } catch ( error ) {
55
+ throw new Error ( 'Failed to parse code\n\n' + code + '\n\n' + error . stack )
56
+ }
53
57
this . _identifiers = null
54
58
this . _ignoreIdTypes = [ ]
55
59
this . _replacedIdentifiers = { }
You can’t perform that action at this time.
0 commit comments