Add useful error to problems with geoip file

This commit is contained in:
Skye 2023-12-14 23:07:17 -05:00
parent 5fab9bc98b
commit 184b854747

View file

@ -2,6 +2,7 @@ use crate::config::LocalTimeConfig;
use crate::output::OutputChannel;
use crate::tile::Block;
use chrono::prelude::*;
use eyre::Context;
use maxminddb::geoip2;
use std::convert::Infallible;
@ -31,7 +32,8 @@ async fn find_time_zone(config: LocalTimeConfig, sender: watch::Sender<State>) -
let Some(geoip_path) = &config.geoip_path else {
eyre::bail!("geoip path not specified");
};
let db_reader = maxminddb::Reader::open_readfile(geoip_path)?;
let db_reader = maxminddb::Reader::open_readfile(geoip_path)
.wrap_err("Could not read specified geoip file path")?;
// Force IPv4 since we don't need to make a request for ipv6
let http_client = reqwest::Client::builder()