Introduce MaybeError type
This commit is contained in:
1 parent
d836b57d2a
commit
a60ed37cd4
16 files changed
+127
-93
No files matched your search
@@ -6,7 +6,7 @@ use crate::data::entities::{CardStatistics, DeckSettings, WordData};
|
||||
use crate::data_provider::voice::get_voice;
|
||||
use crate::navigation::Page::PreviousPage;
|
||||
use crate::navigation::{KeyPressedPage, NavigatedPage, Page, RootMessage};
|
||||
use crate::notification::NotificationData;
|
||||
use crate::notification::{MaybeError, NotificationData};
|
||||
use crate::styling::*;
|
||||
use crate::{push_error, push_error_task};
|
||||
use chrono::Local;
|
||||
@@ -337,7 +337,7 @@ pub enum RepetitionMessage {
|
||||
async fn play_sound(
|
||||
sink: Arc<Option<MixerDeviceSink>>,
|
||||
text: String,
|
||||
) -> Result<(), NotificationData> {
|
||||
) -> MaybeError {
|
||||
let data = get_voice(text.as_str()).await?;
|
||||
spawn_blocking(move || {
|
||||
if let Some(sink) = sink.as_ref()
|
||||
@@ -347,6 +347,6 @@ async fn play_sound(
|
||||
}
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
.expect("Playing sound failed");
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user