1use thiserror::Error;
6
7pub type Result<T> = std::result::Result<T, CoreError>;
9
10#[derive(Debug, Error, PartialEq)]
12pub enum CoreError {
13 #[error("Choice 型の候補数は 1〜255 個である必要がありますが、{count} 個指定されました。")]
15 InvalidChoiceCount {
16 count: usize,
18 },
19
20 #[error("Score 型の評価尺度数は 2〜10 段階である必要がありますが、{count} 個指定されました。")]
22 InvalidScoreLevelCount {
23 count: usize,
25 },
26
27 #[error(
29 "{question_type} 型に対して不正な Criteria 形式が指定されました。期待値: {expected}、実際: {actual}。"
30 )]
31 InvalidCriteriaType {
32 question_type: String,
34 expected: &'static str,
36 actual: &'static str,
38 },
39
40 #[error("{question_type} 型には Criteria の指定が必須です。")]
42 MissingCriteria {
43 question_type: String,
45 },
46
47 #[error("リクエストに含まれる questions が空です。1 件以上の質問を指定してください。")]
49 EmptyQuestions,
50
51 #[error("数値計算エラーが発生しました: {message}。")]
53 MathError {
54 message: String,
56 },
57
58 #[error("シリアライズ/デシリアライズに失敗しました: {message}。")]
60 SerializationError {
61 message: String,
63 },
64
65 #[error("ゲーティング設定が不正です: {message}。")]
67 InvalidGatingConfig {
68 message: String,
70 },
71}