Documentation
¶
Index ¶
- type ServiceError
- func AuthenticationError(message string) *ServiceError
- func BlockchainError(message string) *ServiceError
- func ConfigurationError(message string) *ServiceError
- func ContractError(contract string, message string) *ServiceError
- func DatabaseError(message string) *ServiceError
- func ExternalServiceError(service string, message string) *ServiceError
- func FieldValidationError(fieldErrors map[string]string) *ServiceError
- func FunctionCompilationError(message string) *ServiceError
- func FunctionError(message string) *ServiceError
- func FunctionExecutionError(functionID int, message string) *ServiceError
- func FunctionMemoryLimitError(functionID int, limit int) *ServiceError
- func FunctionTimeoutError(functionID int, timeout int) *ServiceError
- func InternalServerError(message string) *ServiceError
- func New(code string, message string, httpStatus int) *ServiceError
- func PermissionDeniedError(resource string, action string) *ServiceError
- func RateLimitExceededError(limit int, windowSeconds int) *ServiceError
- func ResourceAlreadyExistsError(resourceType string, key string, value interface{}) *ServiceError
- func ResourceConflictError(resourceType string, reason string) *ServiceError
- func ResourceNotFoundError(resourceType string, id interface{}) *ServiceError
- func TokenExpiredError() *ServiceError
- func TokenInvalidError(reason string) *ServiceError
- func TransactionError(txid string, message string) *ServiceError
- func ValidationError(message string) *ServiceError
- func (e *ServiceError) Error() string
- func (e *ServiceError) ToResponse() map[string]interface{}
- func (e *ServiceError) Unwrap() error
- func (e *ServiceError) WithCause(err error) *ServiceError
- func (e *ServiceError) WithDetail(key string, value interface{}) *ServiceError
- func (e *ServiceError) WithDetails(details map[string]interface{}) *ServiceError
- func (e *ServiceError) WithHelpURL(url string) *ServiceError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceError ¶
type ServiceError struct {
Code string `json:"code"`
Message string `json:"message"`
Details map[string]interface{} `json:"details,omitempty"`
HelpURL string `json:"help_url,omitempty"`
HTTPStatus int `json:"-"`
// contains filtered or unexported fields
}
ServiceError is the base error type for the service
func AuthenticationError ¶
func AuthenticationError(message string) *ServiceError
AuthenticationError creates a new authentication error
func BlockchainError ¶
func BlockchainError(message string) *ServiceError
BlockchainError creates a blockchain error
func ConfigurationError ¶
func ConfigurationError(message string) *ServiceError
ConfigurationError creates a configuration error
func ContractError ¶
func ContractError(contract string, message string) *ServiceError
ContractError creates a blockchain contract error
func DatabaseError ¶
func DatabaseError(message string) *ServiceError
DatabaseError creates a database error
func ExternalServiceError ¶
func ExternalServiceError(service string, message string) *ServiceError
ExternalServiceError creates an external service error
func FieldValidationError ¶
func FieldValidationError(fieldErrors map[string]string) *ServiceError
FieldValidationError creates a validation error for specific fields
func FunctionCompilationError ¶
func FunctionCompilationError(message string) *ServiceError
FunctionCompilationError creates a function compilation error
func FunctionError ¶
func FunctionError(message string) *ServiceError
FunctionError creates a function error
func FunctionExecutionError ¶
func FunctionExecutionError(functionID int, message string) *ServiceError
FunctionExecutionError creates a function execution error
func FunctionMemoryLimitError ¶
func FunctionMemoryLimitError(functionID int, limit int) *ServiceError
FunctionMemoryLimitError creates a function memory limit error
func FunctionTimeoutError ¶
func FunctionTimeoutError(functionID int, timeout int) *ServiceError
FunctionTimeoutError creates a function timeout error
func InternalServerError ¶
func InternalServerError(message string) *ServiceError
InternalServerError creates a new internal server error
func New ¶
func New(code string, message string, httpStatus int) *ServiceError
New creates a new ServiceError
func PermissionDeniedError ¶
func PermissionDeniedError(resource string, action string) *ServiceError
PermissionDeniedError creates a permission denied error
func RateLimitExceededError ¶
func RateLimitExceededError(limit int, windowSeconds int) *ServiceError
RateLimitExceededError creates a rate limit exceeded error
func ResourceAlreadyExistsError ¶
func ResourceAlreadyExistsError(resourceType string, key string, value interface{}) *ServiceError
ResourceAlreadyExistsError creates a resource already exists error
func ResourceConflictError ¶
func ResourceConflictError(resourceType string, reason string) *ServiceError
ResourceConflictError creates a resource conflict error
func ResourceNotFoundError ¶
func ResourceNotFoundError(resourceType string, id interface{}) *ServiceError
ResourceNotFoundError creates a new resource not found error
func TokenExpiredError ¶
func TokenExpiredError() *ServiceError
TokenExpiredError creates a token expired error
func TokenInvalidError ¶
func TokenInvalidError(reason string) *ServiceError
TokenInvalidError creates a token invalid error
func TransactionError ¶
func TransactionError(txid string, message string) *ServiceError
TransactionError creates a blockchain transaction error
func ValidationError ¶
func ValidationError(message string) *ServiceError
ValidationError creates a new validation error
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
Error implements the error interface
func (*ServiceError) ToResponse ¶
func (e *ServiceError) ToResponse() map[string]interface{}
ToResponse returns the error as an API response
func (*ServiceError) Unwrap ¶
func (e *ServiceError) Unwrap() error
Unwrap returns the cause of this error
func (*ServiceError) WithCause ¶
func (e *ServiceError) WithCause(err error) *ServiceError
WithCause adds the underlying cause to the error
func (*ServiceError) WithDetail ¶
func (e *ServiceError) WithDetail(key string, value interface{}) *ServiceError
WithDetail adds a single detail to the error
func (*ServiceError) WithDetails ¶
func (e *ServiceError) WithDetails(details map[string]interface{}) *ServiceError
WithDetails adds details to the error
func (*ServiceError) WithHelpURL ¶
func (e *ServiceError) WithHelpURL(url string) *ServiceError
WithHelpURL sets a custom help URL for the error