From: Frank Duncan Date: Sat, 18 Dec 2021 16:47:36 +0000 (-0600) Subject: Failures handles invalid project name gracefully X-Git-Url: https://code.consxy.com/gitweb/?a=commitdiff_plain;h=09ef79e902dcf475d6cd9dc34bc74a46b39150c3;p=candle Failures handles invalid project name gracefully --- diff --git a/src/main/server.lisp b/src/main/server.lisp index 035ba4c..f086aa2 100644 --- a/src/main/server.lisp +++ b/src/main/server.lisp @@ -149,10 +149,10 @@ *all-project*)) (defun failures (project-name) - (length - (remove-if-not - (lambda (branch) (eql :failed (job-status (branch-job branch)))) - (if project-name - (find-branch-by-project - (find project-name *all-project* :test #'string= :key #'project-name)) - *all-branch*)))) + (let + ((project (when project-name (find project-name *all-project* :test #'string= :key #'project-name)))) + (when (and project-name (not project)) (raise-candle-error :project-does-not-exist)) + (length + (remove-if-not + (lambda (branch) (eql :failed (job-status (branch-job branch)))) + (if project (find-branch-by-project project) *all-branch*)))))