client/api/error_registry.go
func (r *MapErrorRegistry) AddMessageError(code int, message string) (*Error, error) {
	if _, ok := r.errors[code]; ok {
		return nil, ErrErrorAlreadyRegistered
	}
	if _, ok := r.handlers[code]; ok {
		return nil, ErrErrorAlreadyRegistered
	}
	err := &Error{
		Message: message,
		Code:    code,
	}
	r.errors[code] = err
	return err, nil
}
func (r *MapErrorRegistry) AddMessageError(code int, message string) (*Error, error) {
	if _, ok := r.errors[code]; ok {
		return nil, ErrErrorAlreadyRegistered
	}
	if _, ok := r.handlers[code]; ok {
		return nil, ErrErrorAlreadyRegistered
	}
	err := &Error{
		Message: message,
		Code:    code,
	}
	r.errors[code] = err
	return err, nil
}
// AddMessageError adds a new Error isntance with a code and message
// to the registry.
// It there already is an error or handler with the same code,
// ErrErrorAlreadyRegistered will be returned.