Skip to content

Commit 209cd10

Browse files
committed
propagate error instead of expect
1 parent 2964ac9 commit 209cd10

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ fn overflow_validation(mode: &PresentMode, config: &ValidateOverflows) -> bool {
214214
fn create_speaker_notes_service_builder(
215215
presentation_path: &Path,
216216
) -> Result<Builder<SpeakerNotesCommand, (), Service>, Box<dyn std::error::Error>> {
217-
let file_name = presentation_path.file_name().expect("failed to resolve presentation file name").to_string_lossy();
217+
let file_name = presentation_path
218+
.file_name()
219+
.ok_or(Cli::command().error(ErrorKind::InvalidValue, "failed to resolve presentation file name"))?
220+
.to_string_lossy();
218221
let service_name = format!("presenterm/{file_name}").as_str().try_into()?;
219222
let service = NodeBuilder::new()
220223
.create::<Service>()?

0 commit comments

Comments
 (0)