Documentation
¶
Index ¶
- Variables
- func HandleApiError(c echo.Context, err error, traceID string) error
- func InvalidAccessToken() error
- func NewGrpcError(message string, httpCode int) error
- func ToGrpcError(err error) error
- type ApiHandler
- type AppError
- func NewBadRequestError(message string) *AppError
- func NewConflictError(message string) *AppError
- func NewErrorResponse(message string, code int) *AppError
- func NewInternalError(err error) *AppError
- func NewNotFoundError(resource string) *AppError
- func NewServiceUnavailableError(service string) *AppError
- func NewValidationError(validations []ValidationError) *AppError
- type ErrorResponse
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadRequest = &AppError{ Code: http.StatusBadRequest, Message: "Bad request", } ErrValidationFailed = &AppError{ Code: http.StatusBadRequest, Message: "Validation failed", } Code: http.StatusUnauthorized, Message: "Unauthorized", } ErrForbidden = &AppError{ Code: http.StatusForbidden, Message: "Forbidden", } ErrNotFound = &AppError{ Code: http.StatusNotFound, Message: "Resource not found", } ErrConflict = &AppError{ Code: http.StatusConflict, Message: "Resource conflict", } ErrTooManyRequests = &AppError{ Code: http.StatusTooManyRequests, Message: "Too many requests", Retryable: true, } ErrInternal = &AppError{ Code: http.StatusInternalServerError, Message: "Internal server error", } Code: http.StatusServiceUnavailable, Message: "Service unavailable", Retryable: true, } ErrTimeout = &AppError{ Code: http.StatusGatewayTimeout, Message: "Request timeout", Retryable: true, } )
Functions ¶
func HandleApiError ¶ added in v1.0.16
func InvalidAccessToken ¶ added in v1.0.16
func InvalidAccessToken() error
func NewGrpcError ¶ added in v1.0.16
func ToGrpcError ¶ added in v1.0.16
GrpcErrorToJson takes a pointer to a gRPC ErrorResponse and returns a string containing the JSON representation of the error.
The function does not return an error and instead panics if the marshaling fails.
Types ¶
type ApiHandler ¶ added in v1.0.16
type ApiHandler interface {
Handle(method string, handler func(echo.Context) error) echo.HandlerFunc
HandleApiErrorWithTracing(c echo.Context, err error, span trace.Span, method string) error
}
func NewApiHandler ¶ added in v1.0.16
func NewApiHandler(observability observability.TraceLoggerObservability, logger logger.LoggerInterface) ApiHandler
type AppError ¶ added in v1.0.16
type AppError struct {
Code int `json:"-"`
Message string `json:"message"`
Retryable bool `json:"retryable,omitempty"`
Validations []ValidationError `json:"validations,omitempty"`
Internal error `json:"-"`
}
func NewBadRequestError ¶ added in v1.0.16
func NewConflictError ¶ added in v1.0.16
func NewErrorResponse ¶ added in v1.0.16
func NewInternalError ¶ added in v1.0.16
func NewNotFoundError ¶ added in v1.0.16
func NewServiceUnavailableError ¶ added in v1.0.16
func NewValidationError ¶ added in v1.0.16
func NewValidationError(validations []ValidationError) *AppError
func (*AppError) AsRetryable ¶ added in v1.0.16
func (*AppError) WithInternal ¶ added in v1.0.16
func (*AppError) WithMessage ¶ added in v1.0.16
func (*AppError) WithValidations ¶ added in v1.0.16
func (e *AppError) WithValidations(validations []ValidationError) *AppError
type ErrorResponse ¶ added in v1.0.16
type ValidationError ¶ added in v1.0.16
Directories
¶
| Path | Synopsis |
|---|---|
|
card_errors
|
|
|
merchant_document_errors
|
|
|
merchant_errors
|
|
|
refresh_token_errors
|
|
|
role_errors
|
|
|
saldo_errors
|
|
|
topup_errors
|
|
|
transaction_errors
|
|
|
transfer_errors
|
|
|
user_errors
|
|
|
user_role_errors
|
|
|
withdraw_errors
|
|
Click to show internal directories.
Click to hide internal directories.