mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-28 21:18:11 -05:00
improve some error logs
...in particular, pass the error as a tracing param rather than directly in the main error message. The new behavior is nicer with e.g. OpenTelemetry.
This commit is contained in:
@@ -397,7 +397,7 @@ fn confirm_deletion(siv: &mut Cursive, db: &Arc<db::Database>, id: i32, to_delet
|
||||
}
|
||||
if let Err(e) = lower_retention(db, zero_limits) {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to delete recordings: {e}"))
|
||||
views::Dialog::text(format!("Unable to delete recordings: {}", e.chain()))
|
||||
.title("Error")
|
||||
.dismiss_button("Abort"),
|
||||
);
|
||||
@@ -433,7 +433,7 @@ fn actually_delete(siv: &mut Cursive, db: &Arc<db::Database>, id: i32) {
|
||||
};
|
||||
if let Err(e) = result {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to delete camera: {e}"))
|
||||
views::Dialog::text(format!("Unable to delete camera: {}", e.chain()))
|
||||
.title("Error")
|
||||
.dismiss_button("Abort"),
|
||||
);
|
||||
|
||||
@@ -51,7 +51,7 @@ fn update_limits_inner(model: &Model) -> Result<(), Error> {
|
||||
fn update_limits(model: &Model, siv: &mut Cursive) {
|
||||
if let Err(e) = update_limits_inner(model) {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to update limits: {e}"))
|
||||
views::Dialog::text(format!("Unable to update limits: {}", e.chain()))
|
||||
.dismiss_button("Back")
|
||||
.title("Error"),
|
||||
);
|
||||
@@ -142,7 +142,7 @@ fn actually_delete(model: &RefCell<Model>, siv: &mut Cursive) {
|
||||
}
|
||||
if let Err(e) = writer::lower_retention(&model.db, model.dir_id, &new_limits[..]) {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to delete excess video: {e}"))
|
||||
views::Dialog::text(format!("Unable to delete excess video: {}", e.chain()))
|
||||
.title("Error")
|
||||
.dismiss_button("Abort"),
|
||||
);
|
||||
@@ -282,9 +282,13 @@ fn add_dir_dialog(db: &Arc<db::Database>, siv: &mut Cursive) {
|
||||
fn add_dir(db: &Arc<db::Database>, siv: &mut Cursive, path: &Path) {
|
||||
if let Err(e) = db.lock().add_sample_file_dir(path.to_owned()) {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to add path {}: {}", path.display(), e))
|
||||
.dismiss_button("Back")
|
||||
.title("Error"),
|
||||
views::Dialog::text(format!(
|
||||
"Unable to add path {}: {}",
|
||||
path.display(),
|
||||
e.chain()
|
||||
))
|
||||
.dismiss_button("Back")
|
||||
.title("Error"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -312,7 +316,7 @@ fn delete_dir_dialog(db: &Arc<db::Database>, siv: &mut Cursive, dir_id: i32) {
|
||||
fn delete_dir(db: &Arc<db::Database>, siv: &mut Cursive, dir_id: i32) {
|
||||
if let Err(e) = db.lock().delete_sample_file_dir(dir_id) {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to delete dir id {dir_id}: {e}"))
|
||||
views::Dialog::text(format!("Unable to delete dir id {dir_id}: {}", e.chain()))
|
||||
.dismiss_button("Back")
|
||||
.title("Error"),
|
||||
);
|
||||
|
||||
@@ -6,7 +6,6 @@ use cursive::traits::{Nameable, Resizable};
|
||||
use cursive::views;
|
||||
use cursive::Cursive;
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
/// Builds a `UserChange` from an active `edit_user_dialog`.
|
||||
fn get_change(
|
||||
@@ -48,7 +47,6 @@ fn get_change(
|
||||
),
|
||||
] {
|
||||
**b = siv.find_name::<views::Checkbox>(id).unwrap().is_checked();
|
||||
info!("{}: {}", id, **b);
|
||||
}
|
||||
change
|
||||
}
|
||||
@@ -61,7 +59,7 @@ fn press_edit(siv: &mut Cursive, db: &Arc<db::Database>, id: Option<i32>, pw: Pa
|
||||
};
|
||||
if let Err(e) = result {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to apply change: {e}"))
|
||||
views::Dialog::text(format!("Unable to apply change: {}", e.chain()))
|
||||
.title("Error")
|
||||
.dismiss_button("Abort"),
|
||||
);
|
||||
@@ -94,7 +92,7 @@ fn actually_delete(siv: &mut Cursive, db: &Arc<db::Database>, id: i32) {
|
||||
};
|
||||
if let Err(e) = result {
|
||||
siv.add_layer(
|
||||
views::Dialog::text(format!("Unable to delete user: {e}"))
|
||||
views::Dialog::text(format!("Unable to delete user: {}", e.chain()))
|
||||
.title("Error")
|
||||
.dismiss_button("Abort"),
|
||||
);
|
||||
|
||||
@@ -439,8 +439,8 @@ async fn inner(
|
||||
|
||||
info!("Waiting for TEARDOWN requests to complete.");
|
||||
for g in session_groups_by_camera.values() {
|
||||
if let Err(e) = g.await_teardown().await {
|
||||
error!("{}", e);
|
||||
if let Err(err) = g.await_teardown().await {
|
||||
error!(%err, "teardown failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user