File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Closure ;
6
6
use Elegantly \Translator \Caches \SearchCodeCache ;
7
+ use Exception ;
7
8
use Illuminate \Contracts \Filesystem \Filesystem ;
8
9
use Illuminate \Support \Facades \Blade ;
9
10
use Illuminate \Support \Facades \Lang ;
@@ -149,8 +150,15 @@ public function translationsByFiles(
149
150
? Blade::compileString ($ file ->getContents ())
150
151
: $ file ->getContents ();
151
152
152
- $ translations = static ::scanCode ($ content );
153
-
153
+ try {
154
+ $ translations = static ::scanCode ($ content );
155
+ } catch (\Throwable $ th ) {
156
+ throw new Exception (
157
+ "File can't be parsed: {$ file ->getPath ()}. Your file might contain a syntax error. You can either fix the file or add it to the ignored path. " ,
158
+ code: 422 ,
159
+ previous: $ th
160
+ );
161
+ }
154
162
$ this ->cache ?->put($ key , $ translations );
155
163
}
156
164
You can’t perform that action at this time.
0 commit comments