From 65d065dd59f7880c00c9015f0bb3ec6e5ef11e77 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Tue, 27 Jun 2023 18:31:41 +0200 Subject: [PATCH] Improve error reporting in station_test.go Modified the error handling sections within the StationSearchByLocation test function to also output the error messages. Changes help in debugging by providing more context whenever the test fails. --- station_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/station_test.go b/station_test.go index d7abc83..cdbfc76 100644 --- a/station_test.go +++ b/station_test.go @@ -46,7 +46,8 @@ func TestClient_StationSearchByLocation_Fail(t *testing.T) { t.Errorf("StationSearchByLocation was supposed to fail but didn't") } if err != nil && !errors.As(err, &APIError{}) { - t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't") + t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't: %s", + err) } c = New(WithAPIKey("invalid")) _, err = c.StationSearchByLocation("Cologne, Germany") @@ -55,7 +56,8 @@ func TestClient_StationSearchByLocation_Fail(t *testing.T) { return } if err != nil && !errors.As(err, &APIError{}) { - t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't") + t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't: %s", + err) } }