1use crate::{
2 prelude::*,
3 runtime::{
4 cache::shared_values_cache::CacheValueRetrievalError,
5 execution::ExecutionError,
6 },
7 shared_values::base_shared_value_container::observers::ObserverError,
8 value_updates::errors::UpdateError,
9};
10use core::fmt::Display;
11
12#[derive(Debug)]
13pub enum DIFResolveReferenceError {
14 ReferenceNotFound,
15}
16impl Display for DIFResolveReferenceError {
17 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
18 match self {
19 DIFResolveReferenceError::ReferenceNotFound => {
20 core::write!(f, "Reference not found")
21 }
22 }
23 }
24}
25
26#[derive(Debug)]
27pub enum DIFObserveError {
28 ReferenceNotFound,
29 ObserveError(ObserverError),
30}
31impl From<ObserverError> for DIFObserveError {
32 fn from(err: ObserverError) -> Self {
33 DIFObserveError::ObserveError(err)
34 }
35}
36impl Display for DIFObserveError {
37 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
38 match self {
39 DIFObserveError::ReferenceNotFound => {
40 core::write!(f, "Reference not found")
41 }
42 DIFObserveError::ObserveError(e) => {
43 core::write!(f, "Observe error: {}", e)
44 }
45 }
46 }
47}
48
49#[derive(Debug)]
50pub enum DIFUpdateError {
51 UpdateError(UpdateError),
52 CacheValueRetrievalError(CacheValueRetrievalError),
53}
54
55impl Display for DIFUpdateError {
56 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57 match self {
58 DIFUpdateError::UpdateError(e) => {
59 core::write!(f, "Update error: {}", e)
60 }
61 DIFUpdateError::CacheValueRetrievalError(e) => {
62 core::write!(f, "Cache value retrieval error: {}", e)
63 }
64 }
65 }
66}
67
68impl From<UpdateError> for DIFUpdateError {
69 fn from(err: UpdateError) -> Self {
70 DIFUpdateError::UpdateError(err)
71 }
72}
73
74impl From<CacheValueRetrievalError> for DIFUpdateError {
75 fn from(err: CacheValueRetrievalError) -> Self {
76 DIFUpdateError::CacheValueRetrievalError(err)
77 }
78}
79
80#[derive(Debug)]
81pub enum DIFApplyError {
82 ExecutionError(Box<ExecutionError>),
83 ReferenceNotFound,
84}
85impl Display for DIFApplyError {
86 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 match self {
88 DIFApplyError::ExecutionError(e) => {
89 core::write!(f, "Execution error: {}", e)
90 }
91 DIFApplyError::ReferenceNotFound => {
92 core::write!(f, "Reference not found")
93 }
94 }
95 }
96}