@@ -694,7 +694,7 @@ class GeocodingServiceSettings:
694694 You can change the service provider and API key in the node settings.
695695 See the [geopy documentation](https://geopy.readthedocs.io/en/stable/#module-geopy.geocoders) for more information.
696696 Notice that the service provider and API key are only required for some service providers.
697- For example, you do not have to enter them for Nomintim or ArcGIS.
697+ For example, you do not have to enter them for Nominatim or ArcGIS.
698698 The addresses can be like `1600 Amphitheatre Parkway, Mountain View, CA`
699699 or `1600 Amphitheatre Parkway, Mountain View, CA, United States`.
700700 """ ,
@@ -712,6 +712,15 @@ class GeoGeocodingNode:
712712 include_row_key = False ,
713713 include_none_column = False ,
714714 )
715+
716+ fail_on_error = knext .BoolParameter (
717+ label = "Fail on error" ,
718+ description = """If selected the node will fail if an error occurs during the geocoding process otherwise it
719+ will add a missing value for each failing address.""" ,
720+ default_value = lambda v : True if v < knext .Version (1 , 3 , 0 ) else False ,
721+ since_version = "1.3.0" ,
722+ is_advanced = True ,
723+ )
715724 name = "geometry"
716725
717726 geocoding_service_settings = GeocodingServiceSettings ()
@@ -767,19 +776,25 @@ def execute(self, exec_context: knext.ExecutionContext, input_table):
767776 try :
768777 result = geocode (row [self .address_col ])
769778 if result is None :
770- knut .LOGGER .warning (
771- f"Got none result at index { index } , address: { row [self .address_col ]} "
772- )
779+ msg = "No address returned by the geocoding service"
780+ if self .fail_on_error :
781+ raise RuntimeError (msg )
782+ else :
783+ knut .LOGGER .warning (
784+ f"{ msg } at index { index } , address: { row [self .address_col ]} "
785+ )
773786 else :
774787 from shapely .geometry import Point
775788
776789 df .at [index , result_col_name ] = Point (
777790 result .longitude , result .latitude
778791 )
779792 except Exception as e :
780- knut .LOGGER .warning (
781- f"Error at index { index } , address: { row [self .address_col ]} , error: { e } "
782- )
793+ if self .fail_on_error :
794+ msg = f"Error at index { index } , address: { row [self .address_col ]} , error: { e } "
795+ raise RuntimeError (msg )
796+ else :
797+ knut .LOGGER .warning (msg )
783798
784799 exec_context .set_progress (
785800 0.9 * process_counter / n_loop ,
0 commit comments