#[non_exhaustive]pub enum Ecr17Error {
FieldOverflow {
value: String,
width: usize,
},
NegativeAmount,
InvalidPaymentType {
value: char,
},
VasTooLong,
TagContentInvalid,
ContractCodeInvalid,
Disconnected,
AckTimeout {
attempts: u32,
},
Nak {
attempts: u32,
},
ResponseTimeout,
Transport {
kind: ErrorKind,
message: String,
},
}Expand description
Errors produced while building or parsing ECR17 messages (and, under the
tokio-transport feature, while talking to a terminal).
The type intentionally derives Clone/PartialEq/Eq (ergonomic for callers and
tests). To keep those derives as new variants are added, error data is modeled with
Clone + Eq types — e.g. transport variants will carry a std::io::ErrorKind plus a
message String rather than a non-Clone/non-Eq std::io::Error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
FieldOverflow
A value is longer than its fixed-width field. ECR17 fields have a fixed length, so an oversized value would shift every following field and corrupt the frame — building it is refused.
NegativeAmount
A monetary amount was negative.
InvalidPaymentType
The payment-type digit was not one of '0' (auto), '1' (debit), '2' (credit),
'3' (other). Refused so a malformed frame is never sent to a card-charging terminal.
VasTooLong
A VAS request payload exceeded the 1024-byte limit.
TagContentInvalid
The additional-data TAG content was empty, longer than 100 chars, or contained the
field separator (0x1B), which would prematurely terminate the field.
ContractCodeInvalid
The tokenization contract code was empty, longer than 18 chars, or contained a non-alphanumeric character (it is interpolated into a structured TAG value).
Disconnected
The transport dropped during an exchange. 💰 A financial command is NEVER blindly
re-sent after this — recover a lost response via send_last_result (G).
AckTimeout
No physical ACK was received after attempts send attempts.
Nak
The terminal NAKed the request after attempts send attempts.
ResponseTimeout
No application response arrived before the response timeout (after the ACK).
Transport
A transport-layer I/O error (real TCP transport). Carries the std::io::ErrorKind
(Clone + Eq) plus a message rather than the non-Clone std::io::Error.
Trait Implementations§
Source§impl Clone for Ecr17Error
impl Clone for Ecr17Error
Source§fn clone(&self) -> Ecr17Error
fn clone(&self) -> Ecr17Error
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Ecr17Error
impl Debug for Ecr17Error
Source§impl Display for Ecr17Error
impl Display for Ecr17Error
impl Eq for Ecr17Error
Source§impl Error for Ecr17Error
impl Error for Ecr17Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for Ecr17Error
Available on crate feature tokio-transport only.
impl From<Error> for Ecr17Error
tokio-transport only.