Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed May 13, 2014
1 parent 8b0740d commit 2a56f6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/com/happyr/java/deferredEventWorker/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ public String getHeader(String name) {
}

public void addHeader(String key, String value) {
headers.put(key, value);
headers.put(key, value.replaceAll(":", "=").replaceAll("[\r\n]", " #> "));
}
}
1 change: 1 addition & 0 deletions src/com/happyr/java/deferredEventWorker/Worker.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void run() {

//if there was any error
if (error != null) {
System.err.println(error);
message.addHeader("error", error);
mq.reportError(message.getFormattedMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public String execute(Message message) {
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);

return "Unknown java error: " + sw.toString().replaceAll("[\n\f\r]", "");
return "Unknown java error: " + sw.toString();
}
}

Expand Down Expand Up @@ -70,7 +70,9 @@ private String doExecute(Message message) throws IOException {
//close the connection
connection.close();

//TODO if error?
return response;
if (connection.hasOutputOnStdErr())
return response;

return null;
}
}

0 comments on commit 2a56f6a

Please sign in to comment.