Skip to content

Commit

Permalink
Merge pull request #1790 from mapfish/better-error
Browse files Browse the repository at this point in the history
Better error message
  • Loading branch information
sbrunner authored Apr 7, 2021
2 parents bdccdb2 + 15db5ed commit 87a6f52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,16 @@ public final synchronized MapPrinter create(@Nullable final String app) throws N
// when throwing a ClosedByInterruptException. so, we do it manually.
// see also http://bugs.java.com/view_bug.do?bug_id=7043425
Thread.currentThread().interrupt();
LOGGER.error("Error occurred while reading configuration file '{}'", configFile);
LOGGER.error(
"Error occurred while reading configuration file '{}', '{}'", configFile, e.getMessage()
);
throw new RuntimeException(String.format(
"Error occurred while reading configuration file '%s': ", configFile),
e);
} catch (Throwable e) {
LOGGER.error("Error occurred while reading configuration file '{}'", configFile);
LOGGER.error(
"Error occurred while reading configuration file '{}', '{}'", configFile, e.getMessage()
);
throw new RuntimeException(String.format(
"Error occurred while reading configuration file '%s'", configFile), e);
}
Expand Down
12 changes: 8 additions & 4 deletions core/src/main/java/org/mapfish/print/servlet/job/PrintJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,23 @@ public final PrintJobResult call() throws Exception {
null :
createResult(fileName, fileExtension, mimeType);
} catch (Exception e) {
String canceledText = "";
if (Thread.currentThread().isInterrupted()) {
canceledText = "(canceled) ";
LOGGER.info(
"Print job canceled {}\n{}",
this.entry.getRequestData(), this.entry.getReferenceId()
);
this.metricRegistry.counter(getClass().getName() + ".canceled").inc();
jobTracker.onJobCancel();
} else {
LOGGER.warn(
"Error executing print job {}\n{}",
this.entry.getRequestData(), this.entry.getReferenceId(), e
);
this.metricRegistry.counter(getClass().getName() + ".error").inc();
jobTracker.onJobError();
}
deleteReport();
maybeSendError(mapPrinter.getConfiguration(), e);
LOGGER.warn("Error executing print job {} {}\n{}",
this.entry.getRequestData(), canceledText, this.entry.getReferenceId(), e);
throw e;
} finally {
final long totalTimeMS = System.currentTimeMillis() - entry.getStartTime();
Expand Down

0 comments on commit 87a6f52

Please sign in to comment.