🎨 Replace QC watcher with Kotlin version
[rhynodge.git] / src / main / java / net / pterodactylus / rhynodge / engine / ReactionRunner.java
index c9af294..f4ae72e 100644 (file)
@@ -48,7 +48,7 @@ public class ReactionRunner implements Runnable {
                State state = runQuery();
                state = runStateThroughFilters(state);
                if (!state.success()) {
-                       logger.info(format("Reaction %s failed.", reaction.name()));
+                       logger.info(format("Reaction %s failed in %s.", reaction.name(), state));
                        saveStateWithIncreasedFailCount(state);
                        errorEmailAction.execute(createErrorOutput(reaction, state));
                        return;
@@ -77,13 +77,14 @@ public class ReactionRunner implements Runnable {
 
        private Output createErrorOutput(Reaction reaction, State state) {
                DefaultOutput output = new DefaultOutput(String.format("Error while processing “%s!”", reaction.name()));
-               output.addText("text/plain; charset=utf-8", createEmailText(reaction, state));
+               output.addText("text/plain", createErrorEmailText(reaction, state));
+               output.addText("text/html", createErrorEmailText(reaction, state));
                return output;
        }
 
-       private String createEmailText(Reaction reaction, State state) {
+       private String createErrorEmailText(Reaction reaction, State state) {
                StringBuilder emailText = new StringBuilder();
-               emailText.append(String.format("An error occured while processing “.”\n\n", reaction.name()));
+               emailText.append(String.format("An error occured while processing “%s.”\n\n", reaction.name()));
                appendExceptionToEmailText(state.exception(), emailText);
                return emailText.toString();
        }