[BUG] validate_email_or_fail function is not raising error but logging it. #96

Closed
opened 2022-09-07 09:46:01 +02:00 by atocyo · 3 comments
  • [v] I have read and understood the FAQ

Describe the bug

validate_email_or_fail function is not raising error but logging it.

To Reproduce

Try to validate email with timing out DNS

My debug output

alt4.gmail-smtp-in.l.google.com resolve error: The resolution lifetime expired after 0.335 seconds: Server 127.0.0.53 UDP port 53 answered The DNS operation timed out.

Expected behavior

Should raise error.

Offending code lines:

     except DNSException as exc:
        LOGGER.warning(msg=f'{hostname} resolve error: {exc}')
<!-- Please don't delete this template or we'll close your issue --> - [v] I have read and understood the [FAQ](https://gitea.ksol.io/karolyi/py3-validate-email/src/branch/master/FAQ.md) **Describe the bug** `validate_email_or_fail` function is not raising error but logging it. **To Reproduce** Try to validate email with timing out DNS **My debug output** alt4.gmail-smtp-in.l.google.com resolve error: The resolution lifetime expired after 0.335 seconds: Server 127.0.0.53 UDP port 53 answered The DNS operation timed out. **Expected behavior** Should raise error. Offending code lines: ``` except DNSException as exc: LOGGER.warning(msg=f'{hostname} resolve error: {exc}') ```
Owner

I don't think this is an error, much less a bug.

Goolag has many SMTP records, and they will be tried to resolve as well, unless you want to resolve only this one specific record. In the case of many records, you'll get an error if none of the existing MX records resolve.

Or in the case of wanting to resolve this specific record, you'll get a NoValidMXError after having found no suitable IP address resolved: 69be4f4b9c/validate_email/dns_check.py (L116)

I don't think this is an error, much less a bug. Goolag has many SMTP records, and they will be tried to resolve as well, unless you want to resolve only this one specific record. In the case of many records, you'll get an error if _none_ of the existing MX records resolve. Or in the case of wanting to resolve this specific record, you'll get a `NoValidMXError` after having found no suitable IP address resolved: https://gitea.ksol.io/karolyi/py3-validate-email/src/commit/69be4f4b9c6f9b1652a7e7638dc6df32b9b08dbf/validate_email/dns_check.py#L116
Author

Thank you for explanation. I agree with your opinion.
Altough in case of raised error, this warning will still be logged.
Maybe there can be made case that this should not be warning and be logged as lower level (debug or info).

In any case, thank you for this package.

Thank you for explanation. I agree with your opinion. Altough in case of raised error, this warning will still be logged. Maybe there can be made case that this should not be warning and be logged as lower level (debug or info). In any case, thank you for this package.
Owner

A warning is a warning for a reason; meaning, it's a problem that can escalate into a bigger problem. Normally you have to specifically enable logging to see those. I see it good as is, but if more people are asking for it, I'm willing to turn it into a debug message only.

A warning is a warning for a reason; meaning, it's a problem that can escalate into a bigger problem. Normally you have to specifically enable logging to see those. I see it good as is, but if more people are asking for it, I'm willing to turn it into a debug message only.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: karolyi/py3-validate-email#96
No description provided.