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 44
55use Closure ;
66use Elegantly \Translator \Caches \SearchCodeCache ;
7+ use Exception ;
78use Illuminate \Contracts \Filesystem \Filesystem ;
89use Illuminate \Support \Facades \Blade ;
910use Illuminate \Support \Facades \Lang ;
@@ -149,8 +150,15 @@ public function translationsByFiles(
149150 ? Blade::compileString ($ file ->getContents ())
150151 : $ file ->getContents ();
151152
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+ }
154162 $ this ->cache ?->put($ key , $ translations );
155163 }
156164
You can’t perform that action at this time.
0 commit comments