Files
fm_be/internal/transport/http/handlers/timezone_helper.go
2026-07-16 22:16:45 +07:00

22 lines
491 B
Go

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},
}}
}