From 31066dc8996be6948c6d0d0dd4c0754b1214ee4c Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Sun, 14 Jul 2024 22:20:27 +0100 Subject: [PATCH] tweak: Resolve flake check issues --- deny.toml | 4 ---- flake.nix | 2 ++ src/sources/github.rs | 12 ++++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) delete mode 100644 deny.toml diff --git a/deny.toml b/deny.toml deleted file mode 100644 index b951a73..0000000 --- a/deny.toml +++ /dev/null @@ -1,4 +0,0 @@ -[licenses] -allow = [ - "MIT" -] diff --git a/flake.nix b/flake.nix index 101136f..66565c6 100644 --- a/flake.nix +++ b/flake.nix @@ -104,6 +104,8 @@ # Audit licenses github-backup-deny = craneLib.cargoDeny { inherit src; + + cargoDenyChecks = "bans sources"; }; # Run tests with cargo-nextest diff --git a/src/sources/github.rs b/src/sources/github.rs index ef9bbc3..f7c2736 100644 --- a/src/sources/github.rs +++ b/src/sources/github.rs @@ -5,7 +5,7 @@ use tracing::instrument; use crate::{ config::Config, - errors, + errors::{self, ResponseError}, policy::{BackupPolicy, RepoFilter}, BackupEntity, RepositorySource, }; @@ -146,7 +146,15 @@ impl GitHubSource { "Make sure that your GitHub token is valid and has not expired.", )) } else { - Err(resp.into()) + let err = ResponseError::with_body(resp).await; + Err(errors::user_with_internal( + &format!( + "The GitHub API returned an error response with status code {}.", + err.status_code + ), + "Please check the error message below and try again.", + err, + )) } } }