It seems that the problem is in line :
Tracing.TraceMsg("Exception text: " + gde.ResponseString);
you guys have added this line in 1.0.9.6 and when i went to ResponseString
property definition, it reads the value from the stream and i know once you
have read this property you cant read that again. Thats the catch because
stream is closed after reading it.
So you guys must have created a "private" "responsestring" variable and store
the read ResponseString variable in that and check whether you have read the
Response earlier or not. If not, read the resposne and assign it to this else
take the value from this variable.
Can you please check ?
Kulvinder Singh <[EMAIL PROTECTED]> wrote:
I have looked at the ResponseString Property of GDataRequestException. In
the request.cs in Google.GData.Client, the error message was "Single Event must
not have a recurrence rule\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", which is
correct but when i try to get the same message through the rethrown
GDataRequestException, i am getting the "stream is not readable" exception.
-- The code below is in request.cs class
public virtual void Execute()
{
try
{
EnsureWebRequest();
// if we ever handed out a stream, we want to close it before doing the real
excecution
if (this.requestStream != null)
{
this.requestStream.Close();
}
Tracing.TraceCall("calling the real execution over the webresponse");
this.webResponse = this.webRequest.GetResponse();
}
catch (WebException e)
{
Tracing.TraceCall("GDataRequest::Execute failed: " +
this.targetUri.ToString());
GDataRequestException gde = new GDataRequestException("Execution of request
failed: " + this.targetUri.ToString(), e);
Tracing.TraceMsg("Exception text: " + gde.ResponseString);
throw gde;
}
Hope this helps.
Kulvinder Singh <[EMAIL PROTECTED]> wrote:
Hi,
I am currently using 1.0.9.6 Google Calendar .NET API. My code to update a
Single event to Recurring one results in a GDataRequest Exception. This i know
is a valid exception. No problem here.
Now when i look into the Response Stream to check what the Error Message has
come form Google Server, i am getting an exception. "Stream is not readable"
The code i am using is :
public static string GetGoogleServerError(GDataRequestException exception)
{
StringBuilder builder = new StringBuilder();
try
{
if (exception.Response != null)
{
Stream receiver = exception.Response.GetResponseStream();
if (receiver != null)
{
// Pipe the stream to ahigher level stream reader with the default encoding
// format. which is UTF8
StreamReader readStream = new StreamReader(receiver);
// Read 256 charcters at a time.
char[] buffer = new char[256];
int count = readStream.Read(buffer, 0, 256);
while (count > 0)
{
builder.Append(buffer);
count = readStream.Read(buffer, 0, 256);
}
// Release the resources of stream object.
readStream.Close();
receiver.Close();
}
}
}
catch(Exception ex)
{
// Do nothing
}
return builder.Replace("\0", "").ToString();
}
The same code was working fine with 1.0.9.4 binaries. The exception i am
getting is in the line :
StreamReader readStream = new StreamReader(receiver);
Whats wrong has been done in 1.0.9.6 or what do i need to change in the above
to get the detailed error message from Google Server in 1.0.9.6 ?
I have only used what you guys said earlier in the post :
http://code.google.com/p/google-gdata/wiki/ErrorHandling and
http://groups.google.com/group/google-calendar-help-dataapi/browse_thread/thread/3a8e3ccd118ec755/3a2d9f88a02b9fa2?lnk=gst&q=http%3A%2F%2Fcode.google.com%2Fp%2Fgoogle-gdata%2Fwiki%2FErrorHandling&rnum=1#3a2d9f88a02b9fa2
Please let me ASAP.
Thanks in advance.
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---