Hi Gabriele,
can you please state which version of Tyrus are you using?
Sources you are referencing are kind of old - we moved to GIT some time
ago, see [1] or (easily browsable) github mirror [2].
As for described issue - I found a test for that, please see [3], line
119, method testDecodeException(). Is that different compared to your
usecase? If so, how? Ideally, if you still can reproduce the issue with
latest release, please include code snippet.
Thanks and regards,
Pavel
[1]
https://java.net/projects/tyrus/sources/code/show
[2]
https://github.com/tyrus-project/tyrus
[3]
https://github.com/tyrus-project/tyrus/blob/e7d822d3aee4dcdcf2df0b0ed7c70123ad9023c5/tests/e2e/standard-config/src/test/java/org/glassfish/tyrus/test/standard_config/DecodedObjectTest.java#L119
On 17/11/14 22:28, Gabriele Carcassi wrote:
>
> Hi!
>
> In the process of implementing error handling on my websocket, I am
> trying to send proper error messages to the client in case the format
> is incorrect. The idea is that I publish the spec of my websocket, I
> have no control of who implements what client, so I need to cover the
> error cases as well.
>
> My expectation is that, for each DecodeException, my @OnError is
> called so that I can properly wire the exception handling. Instead, I
> am noticing that the DecodeExceptions thrown by the decoders seems to
> be disappear in the framework. Looking at the code, EndpointWrapper:
>
> https://java.net/projects/tyrus/sources/source-code-repository/content/trunk/core/src/main/java/org/glassfish/tyrus/core/EndpointWrapper.java?rev=762
>
> calls the decoder, and just adds the exceptions to the ErrorCollector:
>
> https://java.net/projects/tyrus/sources/source-code-repository/content/trunk/core/src/main/java/org/glassfish/tyrus/core/ErrorCollector.java?rev=762
>
> After that, I do not see that they result in notifications on the
> WSEndpoint. As of now, they seem to be silently ignored (unless you
> turn on the logging), which I don't feel is right...
>
> Here:
>
> https://docs.oracle.com/javaee/7/api/javax/websocket/Endpoint.html#onError%28javax.websocket.Session,%20java.lang.Throwable%29
>
> says one type of errors are "conversion errors encoding incoming
> messages before any message handler has been called. These are modeled
> as DecodeExceptions". Which seems to suggest my expectation was right.
> But I am not sure...
>
> As a workaround, I am creating the decoder myself, hooking it up to
> the @OnOpen/_at_OnMessage/_at_OnClose. It works, but it's less than ideal.
>
> Should I consider this behavior a bug (and report it as such)? Or is
> it intended?
>
> Thanks!
>
> Gabriele
>