~goorzhel/sota-slack-spotter

c9e946f297851f760d8e9b3819e7076363fafb56 — Antonio Gurgel a month ago 29214c8
Add missing .context()s
2 files changed, 4 insertions(+), 3 deletions(-)

M src/slack.rs
M src/sota/alert.rs
M src/slack.rs => src/slack.rs +2 -1
@@ 40,7 40,8 @@ impl Slack {
            &self.http_client,
            &self.token,
            &ListRequest { presence: None },
        )?;
        )
        .context("Slack API call failed")?;
        if resp.members.is_none() {
            Err(anyhow!("Somehow, no users found"))
        } else {

M src/sota/alert.rs => src/sota/alert.rs +2 -2
@@ 5,7 5,7 @@ use std::{
    hash::{Hash, Hasher},
};

use anyhow::{anyhow, Result};
use anyhow::{anyhow, Context, Result};
use reqwest::blocking::get;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, NoneAsEmptyString};


@@ 19,7 19,7 @@ const ALERTS_URL: &str = "https://api2.sota.org.uk/api/alerts";

/// Fetch alerts from SOTA API.
pub fn all_alerts() -> Result<Vec<Alert>> {
    let response = get(ALERTS_URL)?;
    let response = get(ALERTS_URL).context("Request failed")?;
    if !response.status().is_success() {
        return Err(anyhow!("Got {} from API", response.status()));
    }