From f232351213f08f4946a33c871f0a995eefca3909 Mon Sep 17 00:00:00 2001 From: apiraino Date: Mon, 8 Apr 2024 15:38:59 +0200 Subject: [PATCH] Handle when user has no PR prefs set --- src/zulip.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/zulip.rs b/src/zulip.rs index 929cb4ba..29bcd2aa 100644 --- a/src/zulip.rs +++ b/src/zulip.rs @@ -214,7 +214,13 @@ async fn query_pr_assignments( let db_client = ctx.db.get().await; let record = match subcommand { - "show" => get_review_prefs(&db_client, gh_id).await?, + "show" => { + let rec = get_review_prefs(&db_client, gh_id).await; + if rec.is_err() { + anyhow::bail!("No preferences set.") + } + rec? + } _ => anyhow::bail!("Invalid subcommand."), };