-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.clj
23 lines (21 loc) · 815 Bytes
/
errors.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(ns depo.errors)
(defn err
"Given a key identifying the type of error, returns a string
containing the error message. `opts` required for certain error
messages.
Possible `error-key`s
- `:no-args` - \"requires atleast one argument\"
- `:invalid-argument` - \"The argument `(:argument opts)` is invalid\"
- `:version-not-exist` - \"`(:artifactID opts)` version `(:version opts)` does not exist\" "
[error-key & opts]
(let [opts (first opts)]
(case error-key
:no-args
"Requires atleast one argument"
:invalid-argument
(str "The argument " (:argument opts) " is invalid")
:version-not-exist
(str (:artifactID opts) " version " (:version opts) " does not exist")
:404
(str (:argument opts) " could not be found from Clojars or Maven")
"")))