Skip to content

Cryptic errors when a plugin fails schema validation #45

@Ramblurr

Description

@Ramblurr

If you have a plugin that does not pass the schema check (missing ::dsp/name or ::dsp/doc for example), the resulting error is not very helpful.

Simple repro:

(require '[donut.system :as ds])
(ds/start {::ds/defs {:foo {::ds/start (fn [_])}}
           ::ds/plugins [{::ds/system-update (fn [s] s)}]})

Results in the exception:

1. Unhandled clojure.lang.ExceptionInfo
   :donut.system/invalid-system

{:explanation {:schema [:map
                        [:donut.system/defs
                        ...]],
               :value nil,
               :errors ({:path [],
                         :in [],
                         :schema [:map
                                  [:donut.system/defs
                                  ...]],
                         :value nil,
                         :type :malli.core/invalid-type})},
 :explanation-human ["invalid type"],
 :donut.error/url "https://donut.party/errors/#:donut.system_invalid-system",
 :donut.error/id :donut.system/invalid-system}


               system.cljc:  887  donut.system$signal/invokeStatic
               system.cljc:  885  donut.system$signal/invoke
               system.cljc:  993  donut.system$start/invokeStatic
               system.cljc:  991  donut.system$start/invoke
                      REPL:   17  myns.core/eval91514

Specifically under :explanation-human "invalid type" message is not helpful, and under :explanation the :path is [] and :value is nil, so it is not at all easy to figure out where exactly the problem is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions