Skip to content

Commit

Permalink
Merge pull request #204 from openclimatefix/fix/422-generation-add-se…
Browse files Browse the repository at this point in the history
…ntry-message

add sentry message for 422
  • Loading branch information
braddf authored Oct 28, 2024
2 parents 9ea6041 + e785c12 commit 1f1b750
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pv_site_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ def post_pv_actual(
generation_values_df["power_kw"] > site_capacity_kw * capacity_factor
]
if len(exceeded_capacity) > 0:
# alert Sentry and return 422 validation error
sentry_sdk.capture_message(
f"Error processing generation values. "
f"One (or more) values are larger than {capacity_factor} "
f"times the site capacity of {site_capacity_kw} kWp. "
f"User: {auth['https://openclimatefix.org/email']}"
f"Site: {site_uuid}"
)
raise HTTPException(
status_code=422,
detail=(
Expand Down

0 comments on commit 1f1b750

Please sign in to comment.