File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Javaabu \Translatable ;
44
5+ use Illuminate \Database \QueryException ;
6+ use Illuminate \Support \Facades \Log ;
57use function array_key_exists ;
68
79use DateInterval ;
@@ -91,9 +93,19 @@ public function getLanguages(array $params = []): Collection
9193 // Load up languages from cache
9294 if ($ this ->languages === null ) {
9395 $ this ->languages = $ this ->cache ->remember (self ::$ cache_key , self ::$ cache_expiration_time , function () {
94- return $ this ->getLanguageClass ()
95- ->active ()
96- ->get ();
96+ try {
97+ return $ this ->getLanguageClass ()
98+ ->active ()
99+ ->get ();
100+ } catch (QueryException $ e ) {
101+ if (app ()->runningUnitTests ()) {
102+ // silently fail if languages can't be loaded in tests
103+ Log::error ('LanguageRegistrarError: ' . $ e ->getMessage ());
104+ return collect ();
105+ }
106+
107+ throw $ e ;
108+ }
97109 });
98110 }
99111
You can’t perform that action at this time.
0 commit comments