File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
eFormAPI/eFormAPI/Controllers Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,22 @@ public OperationResult ConnectionStringExist()
4242 [ Route ( "api/settings/default-locale" ) ]
4343 public OperationDataResult < string > GetDefaultLocale ( )
4444 {
45- var configuration = WebConfigurationManager . OpenWebConfiguration ( "~" ) ;
46- var section = ( AppSettingsSection ) configuration . GetSection ( "appSettings" ) ;
47- var locale = section . Settings [ "general:defaultLocale" ] . Value ;
48- if ( locale == null )
45+ try
46+ {
47+ var configuration = WebConfigurationManager . OpenWebConfiguration ( "~" ) ;
48+ var section = ( AppSettingsSection ) configuration . GetSection ( "appSettings" ) ;
49+ var locale = section . Settings [ "general:defaultLocale" ] . Value ;
50+ if ( locale == null )
51+ {
52+ return new OperationDataResult < string > ( true , "en-US" ) ;
53+ }
54+ return new OperationDataResult < string > ( true , model : locale ) ;
55+ } catch
4956 {
57+ // We do this if any of the above fail for some reason, then we set it to default en-US
5058 return new OperationDataResult < string > ( true , "en-US" ) ;
5159 }
52- return new OperationDataResult < string > ( true , model : locale ) ;
60+
5361 }
5462
5563
You can’t perform that action at this time.
0 commit comments