init push
This commit is contained in:
21
internal/transport/http/handlers/timezone_helper.go
Normal file
21
internal/transport/http/handlers/timezone_helper.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
tzpkg "wucher/internal/shared/pkg/timezone"
|
||||
"wucher/internal/transport/http/jsonapi"
|
||||
)
|
||||
|
||||
func timezoneValidationError(pointer string, err error) []jsonapi.ErrorObject {
|
||||
detail := "timezone must be a valid IANA timezone"
|
||||
if errors.Is(err, tzpkg.ErrEmpty) {
|
||||
detail = "timezone cannot be empty"
|
||||
}
|
||||
return []jsonapi.ErrorObject{{
|
||||
Status: "422",
|
||||
Title: "Validation error",
|
||||
Detail: detail,
|
||||
Source: &jsonapi.ErrorSource{Pointer: pointer},
|
||||
}}
|
||||
}
|
||||
Reference in New Issue
Block a user