Skip to content

Commit

Permalink
log error only if the user is not responsible
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Aug 22, 2023
1 parent d6b7599 commit 1cbddfe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lemarche/utils/mtcaptcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def check_captcha_token(form_data):
if response.json().get("success", False):
return True
else:
logger.exception("Token failed : %s", response.json()["fail_codes"])
# Log event only if the user is not responsible, see https://www.mtcaptcha.com/dev-guide
if response.json()["fail_codes"] not in ["token-expired", "invalid-token"]:
logger.exception("Token failed : %s", response.json()["fail_codes"])
else:
logger.exception("Bad status code when calling Mtcaptcha API-> check-token: %s", response)
except Exception as e:
Expand Down

0 comments on commit 1cbddfe

Please sign in to comment.