Should fail to create invalid rule
This commit is contained in:
@@ -55,6 +55,10 @@
|
||||
(assert-admin (:id context))
|
||||
(let [existing-transaction (tr/get-by-id id)
|
||||
account-total (reduce + 0 (map (fn [x] (:percentage x)) accounts))
|
||||
_ (try
|
||||
(. java.util.regex.Pattern (compile description java.util.regex.Pattern/CASE_INSENSITIVE))
|
||||
(catch Exception e
|
||||
(throw (ex-info (ex-message e) {:validation-error (ex-message e)}))))
|
||||
_ (when-not (dollars= 1.0 account-total)
|
||||
(let [error (str "Account total (" account-total ") does not reach 100%")]
|
||||
(throw (ex-info error {:validation-error error}))))
|
||||
|
||||
Reference in New Issue
Block a user