Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jira error handling improvements #911

Merged
merged 2 commits into from Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/yetibot/api/jira.clj
Expand Up @@ -40,7 +40,8 @@
"Retrieve the list of configured projects for a channel, given its settings"
[channel-settings]
(when-let [setting (channel-settings jira-project-setting-key)]
(s/split setting #",\s*")))
(info "channel-projects" (pr-str setting))
(seq (remove s/blank? (s/split setting #",\s*")))))

(defn config [] (:value (get-config jira-schema [:jira])))

Expand Down
15 changes: 10 additions & 5 deletions src/yetibot/commands/jira.clj
Expand Up @@ -233,11 +233,16 @@
{:yb/cat #{:issue}}
[{:keys [settings]}]
(binding [api/*jira-projects* (channel-projects settings)]
(report-if-error
#(api/recent)
(fn [res]
{:result/value (short-jira-list res)
:result/data (-> res :body :issues)}))))
(info "recent" (pr-str api/*jira-projects*))
(if api/*jira-projects*
(report-if-error
#(api/recent)
(fn [res]
{:result/value (short-jira-list res)
:result/data (-> res :body :issues)}))
{:result/error
"You don't have any JIRA projects configured for this channel. Use `channel set jira-project PROJECT1,PROJECT2` to configure 1 or more."
})))

(defn search-cmd
"jira search <query> # return up to 15 issues matching <query> across all configured projects"
Expand Down