Permalink
Browse files

Pass in the caused-by exception when chaining exceptions, to help wit…

…h debugging
  • Loading branch information...
1 parent 4fcde51 commit 98e25a26fa20cb92f73c73504332a24eac04182c @spudbean spudbean committed Jul 29, 2011
View
4 src/java/com/opensymphony/module/sitemesh/parser/AbstractPage.java
@@ -56,7 +56,7 @@ public String getPage() {
writePage(writer);
return writer.toString();
} catch (IOException e) {
- throw new IllegalStateException("Could not get page " + e.getMessage());
+ throw new IllegalStateException("Could not get page " + e.getMessage(), e);
}
}
@@ -74,7 +74,7 @@ public String getBody() {
writeBody(writer);
return writer.toString();
} catch (IOException e) {
- throw new IllegalStateException("Could not get body " + e.getMessage());
+ throw new IllegalStateException("Could not get body " + e.getMessage(), e);
}
}
View
2 src/java/com/opensymphony/module/sitemesh/parser/PartialPageParserHtmlPage.java
@@ -70,7 +70,7 @@ public String getHead()
try {
head.writeTo(headString);
} catch (IOException e) {
- throw new RuntimeException("IOException occured while writing to buffer?");
+ throw new RuntimeException("IOException occured while writing to buffer?", e);
}
return headString.toString();
}
View
6 src/java/com/opensymphony/sitemesh/compatability/Content2HTMLPage.java
@@ -36,7 +36,7 @@ public String getPage() {
writePage(writer);
return writer.toString();
} catch (IOException e) {
- throw new IllegalStateException("Could not get page " + e.getMessage());
+ throw new IllegalStateException("Could not get page " + e.getMessage(), e);
}
}
@@ -50,7 +50,7 @@ public String getBody() {
writeBody(writer);
return writer.toString();
} catch (IOException e) {
- throw new IllegalStateException("Could not get body " + e.getMessage());
+ throw new IllegalStateException("Could not get body " + e.getMessage(), e);
}
}
@@ -64,7 +64,7 @@ public String getHead() {
writeHead(writer);
return writer.toString();
} catch (IOException e) {
- throw new IllegalStateException("Could not get head " + e.getMessage());
+ throw new IllegalStateException("Could not get head " + e.getMessage(), e);
}
}
View
6 src/java/com/opensymphony/sitemesh/webapp/decorator/BaseWebAppDecorator.java
@@ -32,11 +32,9 @@ public void render(Content content, SiteMeshContext context) {
try {
render(content, webAppContext.getRequest(), webAppContext.getResponse(), webAppContext.getServletContext(), webAppContext);
} catch (IOException e) {
- // TODO: Decent exception handling
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (ServletException e) {
- // TODO: Decent exception handling
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
}

0 comments on commit 98e25a2

Please sign in to comment.