Shared functions for channel implementations. | (ns metabase.channel.shared (:require [malli.core :as mc] [malli.error :as me] [metabase.util.i18n :refer [tru]])) |
Validate a value against a schema and throw an exception if it's invalid. The :errors key are used on the UI to display field-specific error messages. | (defn validate-channel-details [schema value] (when-let [errors (some-> (mc/explain schema value) me/humanize)] (throw (ex-info (tru "Invalid channel details") {:errors errors})))) |