From e8b2b01e7c697435f3d20657cdef0ecd54b62d14 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 15 Sep 2021 21:29:12 +0200 Subject: Rewrote navitia_api_client tests for consistency --- pkg/navitia_api_client/error.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'pkg/navitia_api_client/error.go') diff --git a/pkg/navitia_api_client/error.go b/pkg/navitia_api_client/error.go index 31080de..2600aec 100644 --- a/pkg/navitia_api_client/error.go +++ b/pkg/navitia_api_client/error.go @@ -8,12 +8,12 @@ type ApiError struct { request string } -func (e *ApiError) Error() string { +func (e ApiError) Error() string { return fmt.Sprintf("Navitia Api error return code %d - %s", e.code, e.request) } func newApiError(code int, request string) error { - return &ApiError{ + return ApiError{ code: code, request: request, } @@ -25,11 +25,11 @@ type HttpClientError struct { err error } -func (e *HttpClientError) Error() string { return fmt.Sprintf("Navitia HttpClient error %s", e.msg) } -func (e *HttpClientError) Unwrap() error { return e.err } +func (e HttpClientError) Error() string { return fmt.Sprintf("Navitia HttpClient error %s", e.msg) } +func (e HttpClientError) Unwrap() error { return e.err } func newHttpClientError(msg string, err error) error { - return &HttpClientError{ + return HttpClientError{ msg: msg, err: err, } @@ -41,11 +41,11 @@ type JsonDecodeError struct { err error } -func (e *JsonDecodeError) Error() string { return fmt.Sprintf("Navitia JsonDecode error %s", e.msg) } -func (e *JsonDecodeError) Unwrap() error { return e.err } +func (e JsonDecodeError) Error() string { return fmt.Sprintf("Navitia JsonDecode error %s", e.msg) } +func (e JsonDecodeError) Unwrap() error { return e.err } func newJsonDecodeError(msg string, err error) error { - return &JsonDecodeError{ + return JsonDecodeError{ msg: msg, err: err, } @@ -57,13 +57,13 @@ type DateParsingError struct { err error } -func (e *DateParsingError) Error() string { +func (e DateParsingError) Error() string { return fmt.Sprintf("Navitia date parsing error %s", e.date) } -func (e *DateParsingError) Unwrap() error { return e.err } +func (e DateParsingError) Unwrap() error { return e.err } func newDateParsingError(date string, err error) error { - return &DateParsingError{ + return DateParsingError{ date: date, err: err, } -- cgit v1.2.3