You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Zac Harvey <zh...@pobox.com> on 2016/02/05 19:02:27 UTC

Syntax error on exception definition

Hi all,

My led.thrift file:

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);
}

When I run 'thrift --gen java led.thrift' I get the following error:

[ERROR:/Users/myuser/tmp/thrift_samples/samples/led.thrift:17] (last 
token was ';')
syntax error
[FAILURE:/Users/myuser/tmp/thrift_samples/samples/led.thrift:17] Parser 
error during include pass.

Any ideas as to where I'm going awry?

Thanks!

Re: Syntax error on exception definition

Posted by Zac Harvey <zh...@pobox.com>.
Rush - thank you (that was it)!

On 2/5/16 2:57 PM, Rush Manbert wrote:
> Hi Zac,
>
> Aren’t you missing data types within the exception definition?
>
> - Rush
>
>> On Feb 5, 2016, at 10:02 AM, Zac Harvey <zh...@pobox.com> wrote:
>>
>> Hi all,
>>
>> My led.thrift file:
>>
>> 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);
>> }
>>
>> When I run 'thrift --gen java led.thrift' I get the following error:
>>
>> [ERROR:/Users/myuser/tmp/thrift_samples/samples/led.thrift:17] (last token was ';')
>> syntax error
>> [FAILURE:/Users/myuser/tmp/thrift_samples/samples/led.thrift:17] Parser error during include pass.
>>
>> Any ideas as to where I'm going awry?
>>
>> Thanks!


Re: Syntax error on exception definition

Posted by Rush Manbert <ru...@paceap.com>.
Hi Zac,

Aren’t you missing data types within the exception definition?

- Rush

> On Feb 5, 2016, at 10:02 AM, Zac Harvey <zh...@pobox.com> wrote:
> 
> Hi all,
> 
> My led.thrift file:
> 
> 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);
> }
> 
> When I run 'thrift --gen java led.thrift' I get the following error:
> 
> [ERROR:/Users/myuser/tmp/thrift_samples/samples/led.thrift:17] (last token was ';')
> syntax error
> [FAILURE:/Users/myuser/tmp/thrift_samples/samples/led.thrift:17] Parser error during include pass.
> 
> Any ideas as to where I'm going awry?
> 
> Thanks!