Rename reactor to watcher
[khatus.git] / bin / khatus_controller
index 60a6b19..de971b2 100755 (executable)
@@ -162,7 +162,7 @@ function set_volume(    mute, left, right) {
     } else if (mute == "yes") {
         db["volume"] = "X"
     } else {
-        error("Unexpected value for 'mute' field: " mute)
+        error("set_volume", "Unexpected value for 'mute' field: " mute)
     }
 }
 
@@ -213,7 +213,7 @@ function alert_check_mpd(    curr, prev, name, body) {
                 " - " db_mpd_song["Album:"] \
                 " - " db_mpd_song["Title:"]
         }
-        alert_trigger_low("alert_check_mpd", "NowPlaying", body)
+        alert_trigger_low("alert_check_mpd", "MpdNowPlaying", body)
     }
 }
 
@@ -537,8 +537,11 @@ function debug(location, msg, values,    sep, vals, key, payload) {
     }
 }
 
-function error(msg) {
-    output_msg("ERROR", msg, "/dev/stderr")
+function error(location, msg) {
+    # TODO: Reconsider classifying internal errors as alerts
+    #       Maybe better to keep the error class distinct and provide a
+    #       an optional transformation from error to alert
+    alert_trigger_hi(location, "KhatusControllerError", msg)
 }
 
 function ensure_numeric(n) {
This page took 0.024275 seconds and 4 git commands to generate.