File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,14 @@ class SqlFormatterCli {
99
99
return this . parseFile ( localConfig ) ;
100
100
}
101
101
102
- async findConfig ( dir = __dirname ) {
102
+ findConfig ( dir = __dirname ) {
103
103
const filePath = path . join ( dir , '.sql-formatter.json' ) ;
104
104
if ( ! fs . existsSync ( filePath ) ) {
105
105
const parentDir = path . resolve ( dir , '..' ) ;
106
106
if ( parentDir === dir ) {
107
107
return null ;
108
108
}
109
- return await this . findConfig ( parentDir ) ;
109
+ return this . findConfig ( parentDir ) ;
110
110
}
111
111
112
112
return filePath ;
@@ -131,12 +131,19 @@ class SqlFormatterCli {
131
131
}
132
132
133
133
async readFile ( filename ) {
134
- return promisify ( fs . readFile ) ( filename , { encoding : 'utf-8' } ) . catch ( e => {
134
+ try {
135
+
136
+
137
+ return promisify ( fs . readFile ) ( filename , { encoding : 'utf-8' } )
138
+ } catch ( e ) {
139
+
140
+
135
141
this . exitWhenIOError ( e , filename ) ;
136
142
console . error ( 'An unknown error has occurred, please file a bug report at:' ) ;
137
143
console . log ( 'https://github.com/sql-formatter-org/sql-formatter/issues\n' ) ;
138
144
throw e ;
139
- } ) ;
145
+
146
+ }
140
147
}
141
148
142
149
exitWhenIOError ( e , infile ) {
You can’t perform that action at this time.
0 commit comments