From: erik Date: Fri, 31 Mar 2006 09:14:31 +0000 (+0000) Subject: More details in messages by traversing exception chain. X-Git-Tag: BEFORE_MAVEN_MIGRATION~117 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=07c8348e7a8a4caddb8590330bddf2825f7da8e4;p=utils More details in messages by traversing exception chain. --- diff --git a/crawler/basic/src/org/wamblee/crawler/AbstractPageRequest.java b/crawler/basic/src/org/wamblee/crawler/AbstractPageRequest.java index 432ebb4a..7607f764 100644 --- a/crawler/basic/src/org/wamblee/crawler/AbstractPageRequest.java +++ b/crawler/basic/src/org/wamblee/crawler/AbstractPageRequest.java @@ -168,7 +168,7 @@ public abstract class AbstractPageRequest implements PageRequest { LOG.debug("Transformed result is \n" + os.toString()); return transformed; } catch (TransformerConfigurationException e) { - throw new RuntimeException(e.getMessage(), e); + throw new TransformerException("Transformer configuration problem", e); } finally { // Release the connection. aMethod.releaseConnection(); diff --git a/crawler/basic/src/org/wamblee/crawler/GetPageRequest.java b/crawler/basic/src/org/wamblee/crawler/GetPageRequest.java index 9bc25608..ac1f9301 100644 --- a/crawler/basic/src/org/wamblee/crawler/GetPageRequest.java +++ b/crawler/basic/src/org/wamblee/crawler/GetPageRequest.java @@ -63,9 +63,9 @@ public class GetPageRequest extends AbstractPageRequest { try { return executeMethod(aClient, method); } catch (TransformerException e) { - throw new PageException(e.getMessage(), e); + throw new PageException("Transformation problem for url " + aUrl, e); } catch (IOException e) { - throw new PageException(e.getMessage(), e); + throw new PageException("Problem getting " + aUrl, e); } } diff --git a/crawler/basic/src/org/wamblee/crawler/PostPageRequest.java b/crawler/basic/src/org/wamblee/crawler/PostPageRequest.java index 598afe05..a090627f 100644 --- a/crawler/basic/src/org/wamblee/crawler/PostPageRequest.java +++ b/crawler/basic/src/org/wamblee/crawler/PostPageRequest.java @@ -55,9 +55,9 @@ public class PostPageRequest extends AbstractPageRequest { try { return executeMethod(aClient, method); } catch (TransformerException e) { - throw new PageException(e.getMessage(), e); + throw new PageException("Transformation problem for url " + aUrl, e); } catch (IOException e) { - throw new PageException(e.getMessage(), e); + throw new PageException("Problem getting page " + aUrl, e); } } diff --git a/crawler/kiss/src/org/wamblee/crawler/kiss/main/Report.java b/crawler/kiss/src/org/wamblee/crawler/kiss/main/Report.java index ab2e3a1c..84014773 100644 --- a/crawler/kiss/src/org/wamblee/crawler/kiss/main/Report.java +++ b/crawler/kiss/src/org/wamblee/crawler/kiss/main/Report.java @@ -1,4 +1,5 @@ /* + * * Copyright 2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -89,7 +90,11 @@ public class Report { * @param aException Exception that caused the problem. */ public void addMessage(String aMessage, Exception aException) { - _messages.add(aMessage + ": " + aException.getMessage()); + String msg = aMessage; + for (Throwable e = aException; e != null; e = e.getCause()) { + msg += ": " + e.getMessage(); + } + addMessage(msg); } /**