func errorResponseBody(err error) *RemoteError {
	var errResp RemoteError
	cause := errgo.Cause(err)
	if cause, ok := cause.(*RemoteError); ok {
		// It's a RemoteError already; Preserve the wrapped
		// error message but copy everything else.
		errResp = *cause
		errResp.Message = err.Error()
		return &errResp
	}

	// It's not a RemoteError. Preserve as much info as we can find.
	errResp.Message = err.Error()
	if coder, ok := cause.(ErrorCoder); ok {
		errResp.Code = coder.ErrorCode()
	}
	return &errResp
}
// errorResponse returns an appropriate error
// response for the provided error.
errorResponse returns an appropriate error
response for the provided error.
// errorResponse returns an appropriate error // response for the provided error .
func errorResponseBody(err error) *RemoteError {
	var errResp RemoteError
	cause := errgo.Cause(err)
	if cause, ok := cause.(*RemoteError); ok {
		errResp = *cause
		errResp.Message = err.Error()
		return &errResp
	}
	errResp.Message = err.Error()
	if coder, ok := cause.(ErrorCoder); ok {
		errResp.Code = coder.ErrorCode()
	}
	return &errResp
}
func errorResponseBody ( err error ) * RemoteError { var errResp RemoteError cause := errgo . Cause ( err ) if cause , ok := cause . ( * RemoteError ) ; ok { errResp = * cause errResp . Message = err . Error ( ) return & errResp } errResp . Message = err . Error ( ) if coder , ok := cause . ( ErrorCoder ) ; ok { errResp . Code = coder . ErrorCode ( ) } return & errResp }
errorResponse returns an appropriate error
response for the provided error.
errorResponse returns an appropriate error response for the provided error .
// It's a RemoteError already; Preserve the wrapped // error message but copy everything else. // It's not a RemoteError. Preserve as much info as we can find.