customer/internal/utils/client_response.go
Pasha 34a88a3a70
Some checks failed
Lint / Lint (push) Failing after 1m2s
rename go.mod
2024-11-18 21:44:09 +00:00

25 lines
566 B
Go

package utils
import (
"net/http"
"gitea.pena/PenaSide/customer/internal/errors"
)
var clientErrors = map[int]error{
http.StatusInternalServerError: errors.ErrInternalError,
http.StatusBadRequest: errors.ErrInvalidArgs,
http.StatusNotImplemented: errors.ErrMethodNotImplemented,
http.StatusNotFound: errors.ErrNotFound,
http.StatusForbidden: errors.ErrNoAccess,
}
func DetermineClientErrorResponse(statusCode int) error {
err, ok := clientErrors[statusCode]
if !ok {
return errors.ErrInternalError
}
return err
}