Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrpcError ¶
NewGrpcErrorWithMessage creates and/or transforms a provided error into a gRPC error
func GrpcErrorFromErr ¶
NewGrpcErrorWithErr creates and/or transforms a provided error into a gRPC error
If the provided `Error` is a known Error within this package we will leverage its details to convert it into a GrpcError. If it is not, we will call directly the method `Error()` that will return a `string` that we will use as the Standard Error Message.
Types ¶
type BackendError ¶
type BackendError struct {
*StandardError
}
BackendError type
Whenever there is an error in the Backend, use this error handler to standardize all errors reported to the users and/or logging to the systems log
Example: ```
statusResult, found := searchResult.Aggregations.Terms("status_counts") if !found { return errors.NewBackendError("Aggregation term 'status_counts' not found") }
```
func NewBackendError ¶
func NewBackendError(format string, args ...interface{}) *BackendError
NewBackendError - create a new backend error
type StandardError ¶
type StandardError struct { Type ErrorType `json:"-"` // Avoid displaying the type to the user Message string `json:"message"` }
StandardError type
For any standard error (that is not either a RestClient nor a Backend), use this error handler to standardize all errors reported to the users and/or logging to the systems log
Example: When there is an invalid `filter` parameter ```
errors.New( errors.InvalidParameter, fmt.Sprintf("Invalid filter '%s' (format: key:value)", filter), )
```
func New ¶
func New(eType ErrorType, msg string) *StandardError
New creates a new StandardError struct
func (StandardError) Error ¶
func (e StandardError) Error() string
Implementation of the `Error` interface
func (StandardError) ToJSON ¶
func (e StandardError) ToJSON() ([]byte, error)
ToJSON converts the StandardError into JSON format
func (StandardError) ToString ¶
func (e StandardError) ToString() string
ToString converts the StandardError into String format
func (StandardError) TypeString ¶
func (e StandardError) TypeString() string
TypeString converts our enum ErrorType into a readable string