impl Error for subsonic error and one other thing
This commit is contained in:
parent
bc9b61aac0
commit
a027922b0e
2 changed files with 12 additions and 2 deletions
|
@ -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 {
|
impl From<reqwest::Error> for Error {
|
||||||
fn from(err: reqwest::Error) -> Self {
|
fn from(err: reqwest::Error) -> Self {
|
||||||
// don't print secret salt/token combo
|
// don't print secret salt/token combo
|
||||||
|
|
|
@ -88,7 +88,7 @@ mod imp {
|
||||||
match api.ping().await {
|
match api.ping().await {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
self.obj().set_status("Connected");
|
self.obj().set_status("Connected");
|
||||||
self.save_async().await;
|
self.save().await;
|
||||||
|
|
||||||
// please REMOVEME once we've killed vala
|
// please REMOVEME once we've killed vala
|
||||||
fn get_random_salt(length: usize) -> String {
|
fn get_random_salt(length: usize) -> String {
|
||||||
|
@ -126,7 +126,7 @@ mod imp {
|
||||||
self.obj().set_authn_can_edit(true);
|
self.obj().set_authn_can_edit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn save_async(&self) {
|
async fn save(&self) {
|
||||||
self.obj().set_authn_can_edit(false);
|
self.obj().set_authn_can_edit(false);
|
||||||
|
|
||||||
// TODO remove unwraps etc etc
|
// TODO remove unwraps etc etc
|
||||||
|
|
Loading…
Reference in a new issue