节俭语法错误

时间:2016-02-05 17:53:21

标签: thrift idl

这里节俭0.9.2。这是我简单的SELECT * FROM `tabel` WHERE substring(`column`, 1, if(mod(length(`column`),2)=0, length(`column`)/2, 1+length(`column`)/2) like %'search_for_string'%; 文件:

led.thrift

当我运行namespace c_glib com.example.led namespace java com.example.led typedef i32 int enum LedState { Off = 0, On = 1 } struct LedToggleCommand { 1: required int ledId; 2: required LedState state; } exception LedUnavailableException { 1: message; 2: cause; } service LedService { oneway void toggle(1: LedToggleCommand cmd) throws (1: LedUnavailableException luex); } 时,我收到以下错误:

thrift --gen java led.thrift

这里发生了什么?

1 个答案:

答案 0 :(得分:1)

您需要添加一些数据类型。

exception LedUnavailableException {
    1: string message;
    2: string cause;
}

此外,(至少)新版本会告诉您......

[FAILURE:test.thrift:22] Oneway methods can't throw exceptions.