mirror of
https://codeberg.org/icewind/rss-webhook-trigger.git
synced 2026-11-30 04:00:49 +01:00
better error logging when trigger request fails
This commit is contained in:
parent
3871623928
commit
b00ad5dc52
1 changed files with 16 additions and 1 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -117,6 +117,17 @@ fn trigger(client: &Agent, feed: &FeedConfig, config: &Config) -> Result<(), Tri
|
||||||
} else {
|
} else {
|
||||||
req.send_empty()?;
|
req.send_empty()?;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let status = res.status();
|
||||||
|
if !status.is_success() {
|
||||||
|
let body = res.into_body().read_to_string()?;
|
||||||
|
error!(
|
||||||
|
status = %status,
|
||||||
|
response = body,
|
||||||
|
"error response while triggering hook"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +141,11 @@ pub struct FeedFetcher {
|
||||||
impl FeedFetcher {
|
impl FeedFetcher {
|
||||||
pub fn new(interval: Duration) -> Self {
|
pub fn new(interval: Duration) -> Self {
|
||||||
FeedFetcher {
|
FeedFetcher {
|
||||||
client: Agent::new_with_defaults(),
|
client: Agent::new_with_config(
|
||||||
|
ureq::config::Config::builder()
|
||||||
|
.http_status_as_error(false)
|
||||||
|
.build(),
|
||||||
|
),
|
||||||
base_interval: interval,
|
base_interval: interval,
|
||||||
cache: HashMap::default(),
|
cache: HashMap::default(),
|
||||||
fetch_plans: HashMap::default(),
|
fetch_plans: HashMap::default(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue