refactor: Improved error handling project-wide and cleaned up some regexes with unnecessary escapes (tail_logs and interpolate_env_vars)
This commit is contained in:
@@ -80,13 +80,19 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
Layout::vertical([Constraint::Length(3), Constraint::Fill(0)])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let block_content = &app.data.radarr_data.add_movie_search.as_ref().unwrap().text;
|
||||
let block_content = &app
|
||||
.data
|
||||
.radarr_data
|
||||
.add_movie_search
|
||||
.as_ref()
|
||||
.expect("add_movie_search must be populated")
|
||||
.text;
|
||||
let offset = app
|
||||
.data
|
||||
.radarr_data
|
||||
.add_movie_search
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_movie_search must be populated")
|
||||
.offset
|
||||
.load(Ordering::SeqCst);
|
||||
let search_results_row_mapping = |movie: &AddMovieSearchResult| {
|
||||
@@ -260,7 +266,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.radarr_data
|
||||
.add_searched_movies
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_searched_movies must be populated")
|
||||
.current_selection()
|
||||
.title
|
||||
.text,
|
||||
@@ -269,7 +275,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.radarr_data
|
||||
.add_searched_movies
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_searched_movies must be populated")
|
||||
.current_selection()
|
||||
.overview
|
||||
.clone(),
|
||||
@@ -287,7 +293,12 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
root_folder_list,
|
||||
tags,
|
||||
..
|
||||
} = app.data.radarr_data.add_movie_modal.as_ref().unwrap();
|
||||
} = app
|
||||
.data
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_ref()
|
||||
.expect("add_movie_modal must exist in this context");
|
||||
|
||||
let selected_monitor = monitor_list.current_selection();
|
||||
let selected_minimum_availability = minimum_availability_list.current_selection();
|
||||
@@ -378,7 +389,7 @@ fn draw_add_movie_select_monitor_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.monitor_list,
|
||||
|monitor| ListItem::new(monitor.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -394,7 +405,7 @@ fn draw_add_movie_select_minimum_availability_popup(f: &mut Frame<'_>, app: &mut
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.minimum_availability_list,
|
||||
|minimum_availability| ListItem::new(minimum_availability.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -410,7 +421,7 @@ fn draw_add_movie_select_quality_profile_popup(f: &mut Frame<'_>, app: &mut App<
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.quality_profile_list,
|
||||
|quality_profile| ListItem::new(quality_profile.clone()),
|
||||
);
|
||||
@@ -426,7 +437,7 @@ fn draw_add_movie_select_root_folder_popup(f: &mut Frame<'_>, app: &mut App<'_>)
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.root_folder_list,
|
||||
|root_folder| ListItem::new(root_folder.path.to_owned()),
|
||||
);
|
||||
|
||||
@@ -87,7 +87,12 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
monitored,
|
||||
path,
|
||||
tags,
|
||||
} = app.data.radarr_data.edit_movie_modal.as_ref().unwrap();
|
||||
} = app
|
||||
.data
|
||||
.radarr_data
|
||||
.edit_movie_modal
|
||||
.as_ref()
|
||||
.expect("edit_movie_modal must exist in this context");
|
||||
let selected_minimum_availability = minimum_availability_list.current_selection();
|
||||
let selected_quality_profile = quality_profile_list.current_selection();
|
||||
|
||||
@@ -175,7 +180,7 @@ fn draw_edit_movie_select_minimum_availability_popup(f: &mut Frame<'_>, app: &mu
|
||||
.radarr_data
|
||||
.edit_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_movie_modal must exist in this context")
|
||||
.minimum_availability_list,
|
||||
|minimum_availability| ListItem::new(minimum_availability.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -191,7 +196,7 @@ fn draw_edit_movie_select_quality_profile_popup(f: &mut Frame<'_>, app: &mut App
|
||||
.radarr_data
|
||||
.edit_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_movie_modal must exist in this context")
|
||||
.quality_profile_list,
|
||||
|quality_profile| ListItem::new(quality_profile.clone()),
|
||||
);
|
||||
|
||||
@@ -99,7 +99,7 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let certification = movie.certification.clone().unwrap_or_default();
|
||||
let quality_profile = quality_profile_map
|
||||
.get_by_left(&movie.quality_profile_id)
|
||||
.unwrap()
|
||||
.expect("Quality profile ID must exist in quality_profile_map")
|
||||
.to_owned();
|
||||
let empty_tag = String::new();
|
||||
let tags = if !movie.tags.is_empty() {
|
||||
@@ -108,7 +108,7 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.iter()
|
||||
.map(|tag_id| {
|
||||
tags_map
|
||||
.get_by_left(&tag_id.as_i64().unwrap())
|
||||
.get_by_left(&tag_id.as_i64().expect("Tag ID must be a valid i64"))
|
||||
.unwrap_or(&empty_tag)
|
||||
.clone()
|
||||
})
|
||||
|
||||
@@ -472,7 +472,7 @@ fn draw_manual_search_confirm_prompt(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
.radarr_data
|
||||
.movie_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("movie_details_modal must exist in this context")
|
||||
.movie_releases
|
||||
.current_selection();
|
||||
let title = if current_selection.rejected {
|
||||
|
||||
Reference in New Issue
Block a user