コード例 #1
0
func (p *ThriftTestHandler) TestException(arg string) (err error) {
	if arg == "Xception" {
		x := thrifttest.NewXception()
		x.ErrorCode = 1001
		x.Message = arg
		return x
	} else if arg == "TException" {
		return thrift.TException(errors.New(arg))
	} else {
		return nil
	}
}
コード例 #2
0
func (p *ThriftTestHandler) TestMultiException(arg0 string, arg1 string) (r *thrifttest.Xtruct, err error) {
	if arg0 == "Xception" {
		x := thrifttest.NewXception()
		x.ErrorCode = 1001
		x.Message = "This is an Xception"
		return nil, x
	} else if arg0 == "Xception2" {
		x2 := thrifttest.NewXception2()
		x2.ErrorCode = 2002
		x2.StructThing = thrifttest.NewXtruct()
		x2.StructThing.StringThing = "This is an Xception2"
		return nil, x2
	}

	res := thrifttest.NewXtruct()
	res.StringThing = arg1
	return res, nil
}