about summary refs log tree commit diff stats
path: root/worker
diff options
context:
space:
mode:
authorLyudmil Angelov <lyudmilangelov@gmail.com>2020-07-10 11:40:34 +0300
committerReto Brunner <reto@labrat.space>2020-07-11 13:51:32 +0200
commitcc44027545a22fe264c3a928f1645a1479f3ad9f (patch)
tree8a24d8d8f7e824369d874375bd5635642854b08c /worker
parent6401b105cb28f03b60f03524c0050983e89bdf7a (diff)
downloadaerc-cc44027545a22fe264c3a928f1645a1479f3ad9f.tar.gz
Make it easier to debug date parsing errors
When message dates failed to parse, the error displayed would try to
include the time object it failed to obtain, which would display as
something like 0001-01-01 00:00:00 UTC, which isn't of much help.

Instead, display the text we were trying to parse into a date, which
makes the problem easier to debug.
Diffstat (limited to 'worker')
-rw-r--r--worker/lib/parse.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/worker/lib/parse.go b/worker/lib/parse.go
index bbea49d..ded7a83 100644
--- a/worker/lib/parse.go
+++ b/worker/lib/parse.go
@@ -178,7 +178,7 @@ func parseDate(h *mail.Header) (time.Time, error) {
 			return t, nil
 		}
 	}
-	return time.Time{}, fmt.Errorf("unrecognized date format: %s", t)
+	return time.Time{}, fmt.Errorf("unrecognized date format: %s", text)
 }
 
 func parseAddressList(h *mail.Header, key string) ([]*models.Address, error) {