File tree Expand file tree Collapse file tree 2 files changed +21
-13
lines changed
packages/cubejs-server-core/dev/templates Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,16 @@ class SourceSnippet {
25
25
}
26
26
27
27
static parse ( source ) {
28
- return parse ( source , {
29
- sourceType : 'module' ,
30
- plugins : [
31
- "jsx"
32
- ]
33
- } ) ;
28
+ try {
29
+ return parse ( source , {
30
+ sourceType : 'module' ,
31
+ plugins : [
32
+ "jsx"
33
+ ]
34
+ } ) ;
35
+ } catch ( e ) {
36
+ throw new Error ( `Can't parse source snippet: ${ e . message } \n${ source } ` ) ;
37
+ }
34
38
}
35
39
36
40
mergeImport ( targetSource , importDeclaration ) {
Original file line number Diff line number Diff line change @@ -10,13 +10,17 @@ class TargetSource {
10
10
constructor ( fileName , source ) {
11
11
this . source = source ;
12
12
this . fileName = fileName ;
13
- this . ast = parse ( source , {
14
- sourceFilename : fileName ,
15
- sourceType : 'module' ,
16
- plugins : [
17
- "jsx"
18
- ]
19
- } ) ;
13
+ try {
14
+ this . ast = parse ( source , {
15
+ sourceFilename : fileName ,
16
+ sourceType : 'module' ,
17
+ plugins : [
18
+ "jsx"
19
+ ]
20
+ } ) ;
21
+ } catch ( e ) {
22
+ throw new Error ( `Can't parse ${ fileName } : ${ e . message } ` ) ;
23
+ }
20
24
this . findAllImports ( ) ;
21
25
this . findAllDefinitions ( ) ;
22
26
this . findDefaultExport ( ) ;
You can’t perform that action at this time.
0 commit comments