本文整理汇总了Golang中go/uber/org/yarpc/encoding/thrift.Response.IsApplicationError方法的典型用法代码示例。如果您正苦于以下问题:Golang Response.IsApplicationError方法的具体用法?Golang Response.IsApplicationError怎么用?Golang Response.IsApplicationError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go/uber/org/yarpc/encoding/thrift.Response
的用法示例。
在下文中一共展示了Response.IsApplicationError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Echo
func (h handler) Echo(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args echo.Echo_Echo_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
success, resMeta, err := h.impl.Echo(ctx, reqMeta, args.Ping)
hadError := err != nil
result, err := echo.Echo_Echo_Helper.WrapResponse(success, err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}
示例2: TestVoid
func (h handler) TestVoid(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args gauntlet.ThriftTest_TestVoid_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
resMeta, err := h.impl.TestVoid(ctx, reqMeta)
hadError := err != nil
result, err := gauntlet.ThriftTest_TestVoid_Helper.WrapResponse(err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}
示例3: SetValue
func (h handler) SetValue(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args kv.KeyValue_SetValue_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
resMeta, err := h.impl.SetValue(ctx, reqMeta, args.Key, args.Value)
hadError := err != nil
result, err := kv.KeyValue_SetValue_Helper.WrapResponse(err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}
示例4: SecondtestString
func (h handler) SecondtestString(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args gauntlet.SecondService_SecondtestString_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
success, resMeta, err := h.impl.SecondtestString(ctx, reqMeta, args.Thing)
hadError := err != nil
result, err := gauntlet.SecondService_SecondtestString_Helper.WrapResponse(success, err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}