ctx.go
func (ctx *ResCtx) ErrorData(v interface{}) error {
	if ctx.Success {
		return errors.New("ctx: cannot read error data since server returned a success response")
	}
	if ctx.errorData == nil {
		return errors.New("ctx: server did not return any error data")
	}

	if err := json.Unmarshal(ctx.errorData, v); err != nil {
		return fmt.Errorf("ctx: cannot deserialize error data: %v", err)
	}
	return nil
}
func (ctx *ResCtx) ErrorData(v interface{}) error {
	if ctx.Success {
		return errors.New("ctx: cannot read error data since server returned a success response")
	}
	if ctx.errorData == nil {
		return errors.New("ctx: server did not return any error data")
	}

	if err := json.Unmarshal(ctx.errorData, v); err != nil {
		return fmt.Errorf("ctx: cannot deserialize error data: %v", err)
	}
	return nil
}
// ErrorData reads the error response data into given object.
// Object should be passed by reference.