diff --git a/search-app/src/cmr/search/api/tags.clj b/search-app/src/cmr/search/api/tags.clj index e5c77a6c9d..65e187f5f2 100644 --- a/search-app/src/cmr/search/api/tags.clj +++ b/search-app/src/cmr/search/api/tags.clj @@ -18,15 +18,15 @@ [headers] (mt/extract-header-mime-type #{mt/json} headers "content-type" true)) -(defn- all-data-contain-errors? - "Whether all entries in data contain errors." +(defn- has-error? + "Whether there's an error in [data]." [data] - (not (some #(nil? (:errors %)) data))) + (some #(contains? % :errors) data)) (defn tag-api-response "Creates a successful tag response with the given data response" ([data] - (if (all-data-contain-errors? data) + (if (has-error? data) (tag-api-response 400 data) (tag-api-response 200 data))) ([status-code data]