main: add path deletion help for disk errors

This commit is contained in:
hinto.janai 2023-04-14 12:56:36 -04:00
parent 29ca04c4f1
commit 7d9ed1b0b8
No known key found for this signature in database
GPG key ID: D47CE05FA175A499

View file

@ -309,15 +309,19 @@ impl App {
Ok(toml) => toml, Ok(toml) => toml,
Err(err) => { Err(err) => {
error!("State ... {}", err); error!("State ... {}", err);
match err { let set = match err {
Io(e) => app.error_state.set(format!("State file: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Io(e) => Some((e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit)),
Path(e) => app.error_state.set(format!("State file: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Path(e) => Some((e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit)),
Serialize(e) => app.error_state.set(format!("State file: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Serialize(e) => Some((e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit)),
Deserialize(e) => app.error_state.set(format!("State file: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Deserialize(e) => Some((e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit)),
Format(e) => app.error_state.set(format!("State file: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Format(e) => Some((e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit)),
Merge(e) => app.error_state.set(format!("State file: {}", e), ErrorFerris::Error, ErrorButtons::ResetState), Merge(e) => Some((e.to_string(), ErrorFerris::Error, ErrorButtons::ResetState)),
_ => (), _ => None,
}; };
if let Some((e, ferris, button)) = set {
app.error_state.set(format!("State file: {}\n\nTry deleting: {}\n\n(Warning: this will delete your Gupax settings)\n\n", e, app.state_path.display()), ferris, button);
}
State::new() State::new()
}, },
}; };
@ -328,15 +332,16 @@ impl App {
Ok(toml) => toml, Ok(toml) => toml,
Err(err) => { Err(err) => {
error!("Node ... {}", err); error!("Node ... {}", err);
match err { let (e, ferris, button) = match err {
Io(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Io(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Path(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Path(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Serialize(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Serialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Deserialize(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Deserialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Format(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Format(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Merge(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Error, ErrorButtons::ResetState), Merge(e) => (e.to_string(), ErrorFerris::Error, ErrorButtons::ResetState),
Parse(e) => app.error_state.set(format!("Node list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Parse(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
}; };
app.error_state.set(format!("Node list: {}\n\nTry deleting: {}\n\n(Warning: this will delete your custom node list)\n\n", e, app.node_path.display()), ferris, button);
Node::new_vec() Node::new_vec()
}, },
}; };
@ -349,15 +354,16 @@ impl App {
Ok(toml) => toml, Ok(toml) => toml,
Err(err) => { Err(err) => {
error!("Pool ... {}", err); error!("Pool ... {}", err);
match err { let (e, ferris, button) = match err {
Io(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Io(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Path(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Path(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Serialize(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Serialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Deserialize(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Deserialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Format(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Format(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Merge(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Error, ErrorButtons::ResetState), Merge(e) => (e.to_string(), ErrorFerris::Error, ErrorButtons::ResetState),
Parse(e) => app.error_state.set(format!("Pool list: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Parse(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
}; };
app.error_state.set(format!("Pool list: {}\n\nTry deleting: {}\n\n(Warning: this will delete your custom pool list)\n\n", e, app.pool_path.display()), ferris, button);
Pool::new_vec() Pool::new_vec()
}, },
}; };
@ -372,15 +378,16 @@ impl App {
Ok(_) => info!("App Init | Creating Gupax-P2Pool API files ... OK"), Ok(_) => info!("App Init | Creating Gupax-P2Pool API files ... OK"),
Err(err) => { Err(err) => {
error!("GupaxP2poolApi ... {}", err); error!("GupaxP2poolApi ... {}", err);
match err { let (e, ferris, button) = match err {
Io(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Io(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Path(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Path(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Serialize(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Serialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Deserialize(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Deserialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Format(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Format(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Merge(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Error, ErrorButtons::ResetState), Merge(e) => (e.to_string(), ErrorFerris::Error, ErrorButtons::ResetState),
Parse(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Parse(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
}; };
app.error_state.set(format!("Gupax P2Pool Stats: {}\n\nTry deleting: {}\n\n(Warning: this will delete your P2Pool payout history...!)\n\n", e, app.gupax_p2pool_api_path.display()), ferris, button);
}, },
} }
info!("App Init | Reading Gupax-P2Pool API files..."); info!("App Init | Reading Gupax-P2Pool API files...");
@ -394,15 +401,16 @@ impl App {
}, },
Err(err) => { Err(err) => {
error!("GupaxP2poolApi ... {}", err); error!("GupaxP2poolApi ... {}", err);
match err { let (e, ferris, button) = match err {
Io(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Io(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Path(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Path(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Serialize(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Serialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Deserialize(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Deserialize(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Format(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Format(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
Merge(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Error, ErrorButtons::ResetState), Merge(e) => (e.to_string(), ErrorFerris::Error, ErrorButtons::ResetState),
Parse(e) => app.error_state.set(format!("GupaxP2poolApi: {}", e), ErrorFerris::Panic, ErrorButtons::Quit), Parse(e) => (e.to_string(), ErrorFerris::Panic, ErrorButtons::Quit),
}; };
app.error_state.set(format!("Gupax P2Pool Stats: {}\n\nTry deleting: {}\n\n(Warning: this will delete your P2Pool payout history...!)\n\n", e, app.gupax_p2pool_api_path.display()), ferris, button);
}, },
}; };
drop(gupax_p2pool_api); drop(gupax_p2pool_api);