Skip to content

Commit

Permalink
fix: include mongo-command writeErrors for http response code (#375)
Browse files Browse the repository at this point in the history
* fix: include mongo-command update_info writeErrors when determining response code

fixes #326

* fix: default to empty dict
  • Loading branch information
dwinston authored Nov 13, 2023
1 parent 4561d85 commit 903f5c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nmdc_runtime/api/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ def _validate_changesheet(df_change: pd.DataFrame, mdb: MongoDatabase):
for result in results_of_updates:
if len(result.get("validation_errors", [])) > 0:
validation_errors.append(result["validation_errors"])
if (
len(write_errors := result.get("update_info", {}).get("writeErrors", {}))
> 0
):
validation_errors.append(write_errors)

if validation_errors:
raise HTTPException(
Expand Down

0 comments on commit 903f5c3

Please sign in to comment.