Opened 11 years ago
Closed 9 years ago
#5081 closed defect (fixed)
Unhelpful SMTP error
| Reported by: | Matt Molyneaux | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | |
| Component: | programming | Keywords: | bitesized |
| Cc: | Parent Tickets: |
Description
We had a user in the IRC channel who had an issue with getting email verification setup. Based on the error they received¹ they assumed that MediaGoblin could route mail to remote hosts on its own². They were slightly confused by all this.
We should catch such errors and provide a more descriptive error that doesn't require the reading of Python tracebacks to understand. Something like "Couldn't contact mail server on <host>:<port>" would be far more helpful.
Feel free to contact me on IRC (moggers87) if you're thinking of tackling this ticket and are unfamiliar with MediaGoblin's internals.
¹: http://pastebin.ca/2965561
²: it cannot
Attachments (3)
Change History (16)
comment:1 by , 11 years ago
| Keywords: | bitesized added; unhelpful removed |
|---|
comment:2 by , 10 years ago
by , 10 years ago
| Attachment: | traceback.txt added |
|---|
by , 10 years ago
| Attachment: | issue_5081.patch added |
|---|
comment:3 by , 10 years ago
I just added a patch for this issue. It's my first try, so I'll be expecting suggestions and corrections.
I basically catched the exceptions and printed the suggested message.
Thanks.
comment:4 by , 10 years ago
| Status: | new → review |
|---|
comment:5 by , 10 years ago
| Owner: | set to |
|---|---|
| Status: | review → in_progress |
Thanks for the patch! Here's a quick review:
- Rather than printing (that might not turn up in error logs) we should raise our own exception here
- Suggestion (by no means required): log the original exception via
logging.debug - Tests!
by , 10 years ago
| Attachment: | issue_5081_rev1.patch added |
|---|
comment:6 by , 10 years ago
I just added a new patch.
I added two tests, created a custom exception with the message and logged to the debug level in logging.
I'll be expecting suggestions and corrections :)
comment:7 by , 10 years ago
| Owner: | removed |
|---|---|
| Status: | in_progress → review |
comment:8 by , 10 years ago
| Owner: | set to |
|---|---|
| Status: | review → in_progress |
Sorry for the wait! A few more things:
- On line 124, there's some unneeded whitespace
- Tests should go in
mediagoblin/tests/test_utils.pywith the other mail tests - You should put the original exception's message into the debug log - otherwise you won't know what's actually happening if you go to debug things later. Something like this:
except socket.error as original_error:
error_message = "Couldn't contact mail server on <{}>:<{}>".format(
mg_globals.app_config['email_smtp_host'],
mg_globals.app_config['email_smtp_port'])
logging.debug("Socket error: %s", original_error)
raise NoSMTPServerError(error_message)
Thanks for working on this :)
comment:9 by , 10 years ago
I think I applied the suggestions. I pushed it to a git repository in: https://github.com/jsandovalc/mediagoblin/tree/fix-unhelpful-smtp-error-5081
The branch is: fix-unhelpful-smtp-error-5081
Thanks for the review. Let me know if more changes are needed.
comment:10 by , 10 years ago
| Owner: | removed |
|---|---|
| Status: | in_progress → review |
comment:11 by , 9 years ago
Looks good to me! I'll ping someone with commit rights to get this merged.
comment:13 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | review → closed |
thank you, merged in 4fcd2e7

Just reviewing this ticket and noticed that the Pastbin link provided has expired. To reproduce it, I've turned off my mail server, then attempted to register (which sends out the verification email), producing the attached traceback:
error: [Errno 111] Connection refused.Regards,
Ben