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