T_EXCEPTION is only used when the server sends a TApplicationException,
which happens when it cannot understand the request or has an unexpected
problem processing it. For normal user-defined exceptions, the T_REPLY
value is used and the response indicates what the result was.
--David
Roger Meier wrote:
> Hi all
>
> I did some tests with THttpServer.cpp, JavaScript langiage binding and
> Tutorial-CppServer using the JSON protocol. I have a strange behavior,
> that I do not understand.
>
> Inside the JSON protocol, the MessageType for exceptions seems to be 2
> instead of 3, see below.
>
> What do I not understand here?
>
> Regards
>
> Roger
>
>
> -----------------------------
>
> Request:
> [1,"calculate",1,0,{"1":{"i32":1},"2":{"rec":{"1":{"i32":1},"2":{"i32":0},"3":{"i32":4}}}}]
>
> Response:
> [1,"calculate",2,0,{"1":{"rec":{"1":{"i32":4},"2":{"str":"Cannot divide
> by 0"}}}}]
>
>
> enum TMessageType {
> T_CALL = 1,
> T_REPLY = 2,
> T_EXCEPTION = 3,
> T_ONEWAY = 4
> };
>