impl Error for subsonic error and one other thing

This commit is contained in:
Erica Z 2024-11-02 11:07:25 +01:00
parent bc9b61aac0
commit a027922b0e
2 changed files with 12 additions and 2 deletions

View file

@ -30,6 +30,16 @@ impl fmt::Display for Error {
}
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::UrlParseError(err) => err.source(),
Self::ReqwestError(err) => err.source(),
_ => None,
}
}
}
impl From<reqwest::Error> for Error {
fn from(err: reqwest::Error) -> Self {
// don't print secret salt/token combo

View file

@ -88,7 +88,7 @@ mod imp {
match api.ping().await {
Ok(()) => {
self.obj().set_status("Connected");
self.save_async().await;
self.save().await;
// please REMOVEME once we've killed vala
fn get_random_salt(length: usize) -> String {
@ -126,7 +126,7 @@ mod imp {
self.obj().set_authn_can_edit(true);
}
async fn save_async(&self) {
async fn save(&self) {
self.obj().set_authn_can_edit(false);
// TODO remove unwraps etc etc