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