Improve error message
This commit is contained in:
parent
4617076104
commit
29f4452fef
2 changed files with 9 additions and 1 deletions
|
|
@ -551,7 +551,9 @@ Use -- to separate script command line args from bb command line args.
|
|||
(if (str/ends-with? opt ".jar")
|
||||
:jar :file) opt
|
||||
:command-line-args (next options))
|
||||
(error (str "File does not exist: " opt) 1)))))))
|
||||
(error (str (if (str/starts-with? opt ":")
|
||||
"Task does not exist: "
|
||||
"File does not exist: ") opt) 1)))))))
|
||||
opts-map))]
|
||||
opts))))
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
(binding [test-utils/*bb-edn-path* (str bb-edn-file#)]
|
||||
~@body)))
|
||||
|
||||
(deftest task-cli-test
|
||||
(with-config {}
|
||||
(is (thrown-with-msg?
|
||||
Exception #"Task does not exist: :sum"
|
||||
(bb :sum)))))
|
||||
|
||||
(deftest babashka-task-test
|
||||
(with-config {:tasks {:sum {:task/type :babashka
|
||||
:task/args ["-e" "(+ 1 2 3)"]}}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue