Summary: | SendAlerts does not correctly handle error on sending emails | ||
---|---|---|---|
Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
Component: | System Administration | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | andrew, gmcharlt, martin.renvoize, tomascohen, victor |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
20.11.00
|
|
Circulation function: | |||
Bug Depends on: | 22343 | ||
Bug Blocks: | |||
Attachments: |
Bug 26922: Correctly handle email sending error from SendAlerts
Bug 26922: Better error handling in SendAlerts Bug 26922: Better error handling in SendAlerts Bug 26922: Better error handling in SendAlerts Bug 26922: Regression tests Bug 26922: Better error handling in SendAlerts Bug 26922: Regression tests |
Description
Jonathan Druart
2020-11-04 09:41:19 UTC
Created attachment 113736 [details] [review] Bug 26922: Correctly handle email sending error from SendAlerts There is something weird going on. With this patch I get a stacktrace of the "unable to establish SMTP connection to localhost port 25" error. Which is okish. The problem is that I've tried to turn off dev_install and see if the error was nicer, and... there is no error now. (Worst, I put a warn in mainpage.pl and I did not find in which log file it landed) Created attachment 113828 [details] [review] Bug 26922: Better error handling in SendAlerts This patch makes SendAlerts display a better error message when sending fails. To test: 1. Set KohaAdminEmailAddress to admin@example.org 2. Edit a vendor, set a valid email address 3. Create a new basket, a new order. Send the basket => FAIL: As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace. 4. Apply this patch and reload all 5. Repeat 3 => SUCCESS: A simpler message is displayed, the stacktrace remains in the logs 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> I'll try to provide some tests for this later. > 3. Create a new basket, a new order. Send the basket
> => FAIL: As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace.
Can't reproduce, in the UI I have «Order e-mail was sent to the vendor.»
The logs contain the error.
env: koha-testing-docker
code: master without patch applied
In the vendor setup I filled an email and ticked «Contact when ordering?»
(In reply to Victor Grousset/tuxayo from comment #5) > > 3. Create a new basket, a new order. Send the basket > > => FAIL: As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace. > > Can't reproduce, in the UI I have «Order e-mail was sent to the vendor.» > The logs contain the error. > > env: koha-testing-docker > code: master without patch applied > > In the vendor setup I filled an email and ticked «Contact when ordering?» I clicked on the 'E-mail order' button. https://snipboard.io/6Yn8W1.jpg Same and that's how I got (and still get after retrying) a success instead of a failure.
When I apply the patch and retry, I get.
> ERROR! - unable to establish SMTP connection to localhost port 25
Which is good!
Even if I don't get the same level of wrong behavior without the patch, the test seems to be a success right?
Yes, we are basically providing a better error message. The original issue was because of dev_install=0, which ended up in a variety of behaviors depending on the age of you docker image. Created attachment 113849 [details] [review] Bug 26922: Better error handling in SendAlerts This patch makes SendAlerts display a better error message when sending fails. To test: 1. Set KohaAdminEmailAddress to admin@example.org 2. Edit a vendor, set a valid email address 3. Create a new basket, a new order. Send the basket => FAIL: As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace. 4. Apply this patch and reload all 5. Repeat 3 => SUCCESS: A simpler message is displayed, the stacktrace remains in the logs 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 113870 [details] [review] Bug 26922: Better error handling in SendAlerts This patch makes SendAlerts display a better error message when sending fails. To test: 1. Set KohaAdminEmailAddress to admin@example.org 2. Edit a vendor, set a valid email address 3. Create a new basket, a new order. Send the basket => FAIL: As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace. 4. Apply this patch and reload all 5. Repeat 3 => SUCCESS: A simpler message is displayed, the stacktrace remains in the logs 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> This works well and passes the QA scripts. Were you still going to add Unit tests to cover the change of return Tomas? Created attachment 113884 [details] [review] Bug 26922: Regression tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 113894 [details] [review] Bug 26922: Better error handling in SendAlerts This patch makes SendAlerts display a better error message when sending fails. To test: 1. Set KohaAdminEmailAddress to admin@example.org 2. Edit a vendor, set a valid email address 3. Create a new basket, a new order. Send the basket => FAIL: As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace. 4. Apply this patch and reload all 5. Repeat 3 => SUCCESS: A simpler message is displayed, the stacktrace remains in the logs 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 113895 [details] [review] Bug 26922: Regression tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Works well, covered by tests.. Thanks Tomas Passing QA Pushed to master for 20.11, thanks to everybody involved! Missing dependencies, not backported to 20.05 |