Closed GoogleCodeExporter closed 9 years ago
The generated code attempt to address this with
Google.Apis.Util.StandardResponse<TOutput> response =
Newtonsoft.Json.JsonConvert.DeserializeObject
<Google.Apis.Util.StandardResponse<TOutput>>(str);
if ((response.Data == null)) {
throw new System.ApplicationException(string.Format("Failed to get response from stream, error was [{0}]", response.Error));
}
return response.Data;
Is this code not working or do you just want a more strongly typed exception
thrown from this generated code?
public class ServerReturnedError extends ApplicationException ?
Original comment by davidwat...@google.com
on 25 May 2011 at 7:25
This exception is caught later in the code, and a different exception is thrown:
System.ApplicationException: Failed to generate object of
type[LanguagesListResponse] from Json.
I would really recommend a strongly typed exception (basically just a
ServiceException / GoogleServiceException) so that one can differentiate
between exceptions thrown on purpose by the API, or unhandled exceptions thrown
by .NET methods
Original comment by mlin...@google.com
on 25 May 2011 at 2:22
Good, thanks for looking into this I'm happy with that approach.
I would envision 3 exceptions with a common base
ApplicationException
|-> GoogleApiException
|-> Server retuned an error - was the data passed in wrong? did this use not have permission to this object?
|-> Failed to connect to server ( NetworkException ) - Retry once online
|-> Other bad things (404/5XX/ Failed to parse Json) - FATAL
Errors which I don't know where they go
Authentication missing/expired/no permission for this service/ developer key vs use
Validation of message (google.api does some of the validations specified in discovery)
Original comment by davidwat...@google.com
on 25 May 2011 at 3:03
Fixed as part of #55
Original comment by mlin...@google.com
on 8 Jun 2011 at 10:24
Original issue reported on code.google.com by
mlin...@google.com
on 24 May 2011 at 7:41