Skip to content

Commit 1a8503a

Browse files
authored
[Fixes #13625] Improved Validation error message on upsert (#13626)
1 parent 02a7619 commit 1a8503a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

geonode/upload/handlers/common/vector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,9 @@ def _create_error_log(self, exec_obj, layers, errors):
12051205
asset_name=log_name,
12061206
)
12071207

1208-
raise UpsertException("Some errors found, please check the error log attached")
1208+
raise UpsertException(
1209+
"Some validations failed. Errors are reported inside a CSV file that can be found inside the assets panel."
1210+
)
12091211

12101212
def _validate_feature(self, data_chunk, model_instance, upsert_key, errors):
12111213
# looping over the chunk data

geonode/upload/tests/unit/test_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_import_resource_should_rase_exp_if_is_invalid(
128128
action=ExecutionRequestAction.UPLOAD.value,
129129
handler_module_path="geonode.upload.handlers.gpkg.handler.GPKGFileHandler",
130130
)
131-
expected_msg = f"Invalid format type. Request: {str(exec_id)}"
131+
expected_msg = "Invalid format type"
132132
self.assertEqual(expected_msg, str(_exc.exception.detail))
133133
ExecutionRequest.objects.filter(exec_id=str(exec_id)).delete()
134134

geonode/upload/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ class ImporterRequestAction(enum.Enum):
118118

119119
def error_handler(exc, exec_id=None):
120120
err = f'{str(exc.detail if hasattr(exc, "detail") else exc.args[0])}'
121-
if "Request:" in err:
122-
return err
123-
return f'{str(exc.detail if hasattr(exc, "detail") else exc.args[0])}. Request: {exec_id}'
121+
return err
124122

125123

126124
class ImporterConcreteManager(GeoServerResourceManager):

0 commit comments

Comments
 (0)