diff --git a/firmware/application/ui_record_view.cpp b/firmware/application/ui_record_view.cpp index a11aefd3..829d8b0f 100644 --- a/firmware/application/ui_record_view.cpp +++ b/firmware/application/ui_record_view.cpp @@ -233,7 +233,7 @@ void RecordView::start() { filename_stem + ".WAV" ); if( create_error.is_valid() ) { - report_error(create_error.value().what()); + handle_error(create_error.value()); } else { writer = std::move(p); } @@ -244,7 +244,7 @@ void RecordView::start() { { const auto metadata_file_error = write_metadata_file(filename_stem + ".TXT"); if( metadata_file_error.is_valid() ) { - report_error(metadata_file_error.value().what()); + handle_error(metadata_file_error.value()); return; } @@ -253,7 +253,7 @@ void RecordView::start() { filename_stem + ".C16" ); if( create_error.is_valid() ) { - report_error(create_error.value().what()); + handle_error(create_error.value()); } else { writer = std::move(p); } @@ -326,10 +326,10 @@ void RecordView::on_tick_second() { } } -void RecordView::report_error(const std::string& message) { +void RecordView::handle_error(const File::Error error) { stop(); if( on_error ) { - on_error(message); + on_error(error.what()); } } diff --git a/firmware/application/ui_record_view.hpp b/firmware/application/ui_record_view.hpp index d6111bf1..14f49877 100644 --- a/firmware/application/ui_record_view.hpp +++ b/firmware/application/ui_record_view.hpp @@ -79,7 +79,7 @@ private: void on_tick_second(); - void report_error(const std::string& message); + void handle_error(const File::Error error); const std::string filename_stem_pattern; const FileType file_type; @@ -120,13 +120,9 @@ private: Message::ID::CaptureThreadError, [this](const Message* const p) { const auto message = *reinterpret_cast(p); - this->on_capture_thread_error(message.error); + this->handle_error(message.error); } }; - - void on_capture_thread_error(File::Error error) { - report_error(error.what()); - } }; } /* namespace ui */