protobuf-net, HttpServer report exceptions from server to client

32 views
Skip to first unread message

lasse

unread,
Aug 1, 2011, 4:59:47 AM8/1/11
to prot...@googlegroups.com
How do I report Exceptions back to the http Client?
I am running a HttpServer that implements the IBasicService interface and when exceptions are throw on the server I get this error on the client.
System.Net.WebException: The remote server returned an error: (400) Bad Request.

Lasse

Marc Gravell

unread,
Aug 1, 2011, 7:15:47 AM8/1/11
to prot...@googlegroups.com
If I understand the meaning, then I would tend to make the exception scenario mean "something is fundamentally wrong with the service", rather than "your request was invalid". The latter scenario is better handled by allow an error message as part of the standard API - which could be anything from a simple Status enum, a basic ErrorMessage string, or anything else you can envisage.

Marc

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/DIcMtydglOoJ.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.



--
Regards,

Marc

lasse

unread,
Sep 26, 2011, 4:42:49 PM9/26/11
to Protocol Buffers
Marc,

Do you have an example of how I return an error message back to the
client?

Lasse

On Aug 1, 12:15 pm, Marc Gravell <marc.grav...@gmail.com> wrote:
> If I understand the meaning, then I would tend to make the exception
> scenario mean "something is fundamentally wrong with the service", rather
> than "your request was invalid". The latter scenario is better handled by
> allow an error message as part of the standard API - which could be anything
> from a simple Status enum, a basic ErrorMessage string, or anything else you
> can envisage.
>
> Marc
>
> On 1 August 2011 09:59, lasse <l...@schouw.me> wrote:
>
>
>
>
>
>
>
>
>
> > How do I report Exceptions back to the http Client?
> > I am running a HttpServer that implements the IBasicService interface and
> > when exceptions are throw on the server I get this error on the client.
> > System.Net.WebException: The **remote server returned an **

lasse

unread,
Sep 26, 2011, 4:52:13 PM9/26/11
to Protocol Buffers
I think I got it now. In the http server I can catch exceptions, and
then return them back in my normal object.

A foo(int i);

where A is a class that I can then add an extra member variable called
Exception on!
Reply all
Reply to author
Forward
0 new messages