EWS: improve error message handling, log error description

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1931 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-03-20 23:09:57 +00:00
parent 321c1b0454
commit 29b99cafff
1 changed files with 9 additions and 3 deletions

View File

@ -79,6 +79,7 @@ public abstract class EWSMethod extends PostMethod {
protected List<Item> responseItems;
protected String errorDetail;
protected String errorDescription;
protected Item item;
protected SearchExpression searchExpression;
@ -464,9 +465,9 @@ public abstract class EWSMethod extends PostMethod {
* attendee fullname
*/
public String name;
}
}
/**
/**
* Recurring event occurrence
*/
public static class Occurrence {
@ -682,7 +683,7 @@ public abstract class EWSMethod extends PostMethod {
&& !"ErrorItemNotFound".equals(errorDetail)
) {
try {
throw new EWSException(errorDetail + "\n request: " + new String(generateSoapEnvelope(), "UTF-8"));
throw new EWSException(errorDetail +" "+((errorDescription!=null)?errorDescription:"")+ "\n request: " + new String(generateSoapEnvelope(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new EWSException(e.getMessage());
}
@ -765,6 +766,11 @@ public abstract class EWSMethod extends PostMethod {
protected void handleErrors(XMLStreamReader reader) throws XMLStreamException {
String result = handleTag(reader, "ResponseCode");
// store error description;
String messageText = handleTag(reader, "MessageText");
if (messageText != null) {
errorDescription = messageText;
}
if (errorDetail == null && result != null
&& !"NoError".equals(result)
&& !"ErrorNameResolutionMultipleResults".equals(result)