@@ -58,7 +58,11 @@ def load_config(self) -> dict | None:
5858 with open (self .config_path , mode = 'rb' ) as infile :
5959 return tomli .load (infile )
6060 except Exception as ex :
61- raise RealWeatherException (f"Error while reading { self .config_path } : { ex } " )
61+ message = f"Error while reading { self .config_path } : { ex } "
62+ if self .config .get ('ignore_errors' , False ):
63+ self .log .error (message )
64+ else :
65+ raise RealWeatherException (message )
6266
6367 def get_config (self , filename : str ) -> dict :
6468 if 'terrains' in self .config :
@@ -116,7 +120,11 @@ async def generate_config_1_0(self, input_mission: str, output_mission: str, ove
116120 with open (self .config_path , mode = 'r' , encoding = 'utf-8' ) as infile :
117121 cfg = json .load (infile )
118122 except json .JSONDecodeError as ex :
119- raise RealWeatherException (f"Error while reading { self .config_path } : { ex } " )
123+ message = f"Error while reading { self .config_path } : { ex } "
124+ if self .config .get ('ignore_errors' , False ):
125+ self .log .error (message )
126+ else :
127+ raise RealWeatherException (message )
120128 config = await asyncio .to_thread (self .get_config , input_mission )
121129 # create proper configuration
122130 for name , element in cfg .items ():
@@ -144,7 +152,12 @@ async def generate_config_2_0(self, input_mission: str, output_mission: str, ove
144152 with open (self .config_path , mode = 'rb' ) as infile :
145153 cfg = tomli .load (infile )
146154 except tomli .TOMLDecodeError as ex :
147- raise RealWeatherException (f"Error while reading { self .config_path } : { ex } " )
155+ message = f"Error while reading { self .config_path } : { ex } "
156+ if self .config .get ('ignore_errors' , False ):
157+ self .log .error (message )
158+ else :
159+ raise RealWeatherException (message )
160+
148161 config = await asyncio .to_thread (self .get_config , input_mission )
149162 # create proper configuration
150163 for name , element in cfg .items ():
@@ -213,8 +226,11 @@ def run_subprocess():
213226 stdout , stderr = process .communicate ()
214227 if process .returncode != 0 :
215228 error = stdout .decode ('utf-8' )
216- self .log .error (error )
217- raise RealWeatherException (f"Error during { self .name } : { process .returncode } - { error } " )
229+ message = f"Error during { self .name } : { process .returncode } - { error } "
230+ if self .config .get ('ignore_errors' , False ):
231+ self .log .error (message )
232+ else :
233+ raise RealWeatherException (message )
218234 output = stdout .decode ('utf-8' )
219235 metar = next ((x for x in output .split ('\n ' ) if 'METAR:' in x ), "" )
220236 remarks = self .locals .get ('realweather' , {}).get ('mission' , {}).get ('brief' , {}).get ('remarks' , '' )
0 commit comments