@@ -108,20 +108,24 @@ pub enum Error {
108
108
/// Includes FeedId that is reocuring.
109
109
ConfigReocuringFeedId ( FeedId ) ,
110
110
111
- /// Indicates that the provided timestamp is not greater than a previously written timestamp.
111
+ /// Indicates that the provided data timestamp is not greater than a previously written package timestamp.
112
112
///
113
113
/// For the price adapter to accept a new price update, the associated timestamp must be
114
114
/// strictly greater than the timestamp of the last update. This error is raised if a new
115
115
/// timestamp does not meet this criterion, ensuring the chronological integrity of price data.
116
- TimestampMustBeGreaterThanBefore ,
116
+ ///
117
+ /// Includes the value of a current package timestamp and the timestamp of the previous package.
118
+ DataTimestampMustBeGreaterThanBefore ( TimestampMillis , TimestampMillis ) ,
117
119
118
- /// Indicates that the current timestamp is not greater than the timestamp of the last update.
120
+ /// Indicates that the current update timestamp is not greater than the last update timestamp .
119
121
///
120
122
/// This error is raised to ensure that the data being written has a timestamp strictly greater
121
123
/// than the most recent timestamp already stored in the system. It guarantees that new data
122
124
/// is not outdated or stale compared to the existing records, thereby maintaining the chronological
123
125
/// integrity and consistency of the updates.
124
- CurrentTimestampMustBeGreaterThanLatestUpdateTimestamp ,
126
+ ///
127
+ /// Includes the value of a current update timestamp and the last update timestamp.
128
+ CurrentTimestampMustBeGreaterThanLatestUpdateTimestamp ( TimestampMillis , TimestampMillis ) ,
125
129
}
126
130
127
131
impl From < CryptoError > for Error {
@@ -151,8 +155,8 @@ impl Error {
151
155
Error :: CryptographicError ( error) => 700 + error. code ( ) ,
152
156
Error :: TimestampTooOld ( data_package_index, _) => 1000 + * data_package_index as u16 ,
153
157
Error :: TimestampTooFuture ( data_package_index, _) => 1050 + * data_package_index as u16 ,
154
- Error :: TimestampMustBeGreaterThanBefore => 1101 ,
155
- Error :: CurrentTimestampMustBeGreaterThanLatestUpdateTimestamp => 1102 ,
158
+ Error :: DataTimestampMustBeGreaterThanBefore ( _ , _ ) => 1101 ,
159
+ Error :: CurrentTimestampMustBeGreaterThanLatestUpdateTimestamp ( _ , _ ) => 1102 ,
156
160
}
157
161
}
158
162
}
@@ -216,13 +220,16 @@ impl Display for Error {
216
220
feed_id. as_hex_str( )
217
221
)
218
222
}
219
- Error :: TimestampMustBeGreaterThanBefore => {
220
- write ! ( f, "Timestamp must be greater than before" )
223
+ Error :: DataTimestampMustBeGreaterThanBefore ( current, before) => {
224
+ write ! (
225
+ f,
226
+ "Package timestamp: {current:?} must be greater than package timestamp before: {before:?}"
227
+ )
221
228
}
222
- Error :: CurrentTimestampMustBeGreaterThanLatestUpdateTimestamp => {
229
+ Error :: CurrentTimestampMustBeGreaterThanLatestUpdateTimestamp ( current , last ) => {
223
230
write ! (
224
231
f,
225
- "Current timestamp must be greater than latest update timestamp"
232
+ "Current update timestamp: {current:?} must be greater than latest update timestamp: {last:?} "
226
233
)
227
234
}
228
235
}
0 commit comments