~goorzhel/sota-slack-spotter

5b969a71b9678b7b791626a65da9c70c4bee16ae — Antonio Gurgel a month ago 47bc994
Add context to all_spots

For consistency with all_alerts.
1 files changed, 2 insertions(+), 2 deletions(-)

M src/sota/spot.rs
M src/sota/spot.rs => src/sota/spot.rs +2 -2
@@ 6,7 6,7 @@ use std::{
    time::Duration,
};

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


@@ 20,7 20,7 @@ use crate::{
/// Fetch spots from SOTA API.
pub fn all_spots(hours: u8) -> Result<Vec<Spot>> {
    let url = format!("https://api2.sota.org.uk/api/spots/-{}/all", hours);
    let response = get(&url)?;
    let response = get(&url).context("Request failed")?;
    if !response.status().is_success() {
        return Err(anyhow!("Got {} from API", response.status()));
    }