flexaudio_core/
whisper_error.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum WhisperCode {
6 InvalidParameter,
8 InvalidProbability,
10 InvalidPcm,
12 Overflow,
14 SessionFinished,
16 Inference,
18 ModelLoad,
20 FailedSession,
22 InvalidStereoLength,
24 CaptureSampleOverflow,
26 PtsOutOfRange,
28 UnsupportedConversionClock,
30 Conversion,
32 Stopped,
34}
35
36impl WhisperCode {
37 pub fn as_str(self) -> &'static str {
39 match self {
40 Self::InvalidParameter => "InvalidParameter",
41 Self::InvalidProbability => "InvalidProbability",
42 Self::InvalidPcm => "InvalidPcm",
43 Self::Overflow => "Overflow",
44 Self::SessionFinished => "SessionFinished",
45 Self::Inference => "Inference",
46 Self::ModelLoad => "ModelLoad",
47 Self::FailedSession => "FailedSession",
48 Self::InvalidStereoLength => "InvalidStereoLength",
49 Self::CaptureSampleOverflow => "CaptureSampleOverflow",
50 Self::PtsOutOfRange => "PtsOutOfRange",
51 Self::UnsupportedConversionClock => "UnsupportedConversionClock",
52 Self::Conversion => "Conversion",
53 Self::Stopped => "Stopped",
54 }
55 }
56
57 pub fn explanation(self) -> &'static str {
59 match self {
60 Self::InvalidParameter => "a segmentation parameter is outside the supported domain",
61 Self::InvalidProbability => "an inference probability is not finite or normalized",
62 Self::InvalidPcm => "PCM contains a nonfinite or out-of-range sample",
63 Self::Overflow => "checked arithmetic or storage exceeds the supported domain",
64 Self::SessionFinished => {
65 "the completed session requires a successful reset before processing"
66 }
67 Self::Inference => "model inference or reset could not complete",
68 Self::ModelLoad => "the embedded model could not be constructed",
69 Self::FailedSession => "a previous processor failure requires a successful reset",
70 Self::InvalidStereoLength => "capture input does not contain complete stereo frames",
71 Self::CaptureSampleOverflow => "the capture sample count exceeds the supported domain",
72 Self::PtsOutOfRange => "the capture timestamp exceeds the supported domain",
73 Self::UnsupportedConversionClock => {
74 "conversion cannot establish an exact sample-aligned clock"
75 }
76 Self::Conversion => "capture conversion could not preserve the valid sample timeline",
77 Self::Stopped => "capture intake has already stopped",
78 }
79 }
80}