#[non_exhaustive]pub enum ServerErrorKind {
Show 67 variants
InternalHdmError,
BadRequest,
BadProtocolVersion,
UnauthorizedConnection,
BadOperationCode,
CryptographicError,
SessionEncryptionError,
HeaderFormatError,
BadSequenceNumber,
BadJsonFormat,
LastReceiptArchiveEmpty,
LastReceiptDifferentUser,
GenericPrintError,
PrinterInitError,
PrinterOutOfPaper,
BadOperatorPassword,
NoSuchOperator,
InactiveOperator,
GenericLoginPrintError,
NoSuchDepartment,
PaidLessThanTotal,
AmountExceedsLimit,
AmountMustBePositive,
HdmSyncRequired,
SyncIncomplete,
BadReturnReceiptNumber,
ReceiptAlreadyReturned,
NonPositiveProductPrice,
DiscountPercentOutOfRange,
BadProductCode,
BadProductName,
EmptyProductUnit,
CashlessPaymentFailure,
ZeroProductPrice,
FinalPriceCalculationError,
CardAmountExceedsTotal,
CardAmountCoversAllCashRedundant,
ReportFiltersError,
ReportTimeRangeError,
InvalidItemPrice,
WrongReceiptType,
InvalidDiscountType,
ReturnReceiptNotFound,
BadReturnReceiptRegNum,
LastReceiptNotFound,
ReturnNotSupportedForType,
AmountCannotBeReturned,
PartialMustBeReturnedInFull,
FullReturnExceedsAmount,
BadReturnProductQuantity,
ReturnReceiptIsReturn,
BadAtgCode,
InvalidPrepaymentReturn,
PartialReturnSyncRequired,
BadPrepaymentAmount,
BadPrepaymentList,
BadAmounts,
BadRounding,
PaymentUnavailable,
NonPositiveCashAmount,
AtgCodeRequired,
BadPartnerTinFormat,
EmarksNotAllowedInPrepayment,
BadEmarkFormat,
OtherUnknownError,
Vendor(VendorErrorKind),
Unknown(u16),
}Expand description
Categorised server response codes per spec §4.10.
Every documented code maps to a named variant. Codes outside the documented set become
Unknown(u16) so that future spec revisions don’t break existing builds.
The variants are grouped roughly by the spec’s own categories: generic errors, login errors,
receipt-print errors. Recovery semantics are exposed via Self::is_retryable,
Self::requires_relogin, and Self::is_fatal_for_connection.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InternalHdmError
500 — Internal HDM error.
BadRequest
400 — Request error (request not processed).
BadProtocolVersion
402 — Bad protocol version.
403 — Unauthorised connection (HDM-registered IP doesn’t match the caller’s).
BadOperationCode
404 — Bad operation code in the header.
CryptographicError
101 — Cryptographic encryption error.
SessionEncryptionError
102 — Session-key encryption error.
HeaderFormatError
103 — Header format error.
BadSequenceNumber
104 — Request sequence number error.
BadJsonFormat
105 — JSON format error.
LastReceiptArchiveEmpty
141 — Last receipt archive is empty.
LastReceiptDifferentUser
142 — Last receipt belongs to a different user.
GenericPrintError
143 — Generic print error.
PrinterInitError
144 — Printer initialisation error.
PrinterOutOfPaper
145 — Printer is out of paper.
BadOperatorPassword
111 — Operator password error.
NoSuchOperator
112 — No such operator (role mismatch, inactive user, or not registered).
InactiveOperator
113 — Operator is inactive.
GenericLoginPrintError
121 — Print error (during login flow).
NoSuchDepartment
151 — No such department (or operator lacks access).
PaidLessThanTotal
152 — Paid amount is less than the total.
AmountExceedsLimit
153 — Receipt amount exceeds the configured limit.
AmountMustBePositive
154 — Receipt amount must be positive.
HdmSyncRequired
155 — HDM synchronisation required before this operation can succeed.
SyncIncomplete
156 — Synchronisation not completed.
BadReturnReceiptNumber
157 — Bad return-receipt number.
ReceiptAlreadyReturned
158 — Receipt already returned.
NonPositiveProductPrice
159 — Non-positive product price or quantity.
DiscountPercentOutOfRange
160 — Discount percent out of range (must be 0..100).
BadProductCode
161 — Bad product code.
BadProductName
162 — Bad product name.
EmptyProductUnit
163 — Empty product unit-of-measure.
CashlessPaymentFailure
164 — Cashless payment failure.
ZeroProductPrice
165 — Product price cannot be zero.
FinalPriceCalculationError
166 — Final price calculation error.
CardAmountExceedsTotal
167 — Card amount is greater than the receipt’s total.
CardAmountCoversAllCashRedundant
168 — Card amount covers the total (cash amount is redundant).
ReportFiltersError
169 — Fiscal-report filter conflict (more than one filter sent).
ReportTimeRangeError
170 — Fiscal-report time range exceeds 2 months.
InvalidItemPrice
171 — Invalid item price value.
WrongReceiptType
172 — Wrong receipt type (not product/simple/prepayment).
InvalidDiscountType
173 — Invalid discount type.
ReturnReceiptNotFound
174 — Return-target receipt does not exist.
BadReturnReceiptRegNum
175 — Bad registration number on the return-target receipt.
LastReceiptNotFound
176 — Last receipt does not exist.
ReturnNotSupportedForType
177 — Return not supported for this receipt type.
AmountCannotBeReturned
178 — Requested return amount cannot be processed.
PartialMustBeReturnedInFull
179 — Partial-payment receipt must be returned in full.
FullReturnExceedsAmount
180 — Full-return amount exceeds available.
BadReturnProductQuantity
181 — Bad return-product quantity.
ReturnReceiptIsReturn
182 — Return receipt is itself a return-type receipt.
BadAtgCode
183 — Bad ATG/ADG code (see taxservice.am for the canonical list).
InvalidPrepaymentReturn
184 — Inappropriate prepayment-return request.
PartialReturnSyncRequired
185 — Cannot return partial-payment receipt; HDM software sync required.
BadPrepaymentAmount
186 — Bad amount in prepayment case.
BadPrepaymentList
187 — Bad list in prepayment case.
BadAmounts
188 — Bad amounts in general.
BadRounding
189 — Bad rounding.
190 — Payment not available.
NonPositiveCashAmount
191 — Cash in/out amount must be greater than zero.
AtgCodeRequired
192 — ATG code is mandatory.
BadPartnerTinFormat
193 — Bad partner-TIN format.
EmarksNotAllowedInPrepayment
194 — eMark codes not allowed in prepayment receipts.
BadEmarkFormat
195 — Bad eMark code format.
OtherUnknownError
196 — Other unknown error documented by the spec.
Vendor(VendorErrorKind)
A vendor/firmware-specific code that is not part of the SRC spec §4.10. Kept in its own
VendorErrorKind enum so spec codes and vendor extensions never blur together; the two
sets are joined only here and in Self::from_code.
Unknown(u16)
Response code present in neither spec v0.7.3 nor the known vendor set. Carried verbatim for forward compatibility.
Implementations§
Source§impl ServerErrorKind
impl ServerErrorKind
Sourcepub const fn from_code(code: u16) -> Self
pub const fn from_code(code: u16) -> Self
Map a numeric response code to its categorised variant.
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Whether retrying the same operation might succeed without changing state.
Conservatively false for most variants. True only for transient conditions (printer-out-of-paper, sync-incomplete, or the HDM’s UI being momentarily busy) where the situation may clear itself between attempts.
Sourcepub const fn requires_relogin(self) -> bool
pub const fn requires_relogin(self) -> bool
Whether the client should call crate::Client::login again before the next operation.
True for session-key invalidation, expired credentials, and operator-state changes detected mid-session.
Sourcepub const fn is_fatal_for_connection(self) -> bool
pub const fn is_fatal_for_connection(self) -> bool
Whether the underlying TCP connection should be closed and re-opened.
Aligned with the “Stops the server connection” column of spec §4.10.
Trait Implementations§
Source§impl Clone for ServerErrorKind
impl Clone for ServerErrorKind
Source§fn clone(&self) -> ServerErrorKind
fn clone(&self) -> ServerErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ServerErrorKind
Source§impl Debug for ServerErrorKind
impl Debug for ServerErrorKind
impl Eq for ServerErrorKind
Source§impl PartialEq for ServerErrorKind
impl PartialEq for ServerErrorKind
Source§fn eq(&self, other: &ServerErrorKind) -> bool
fn eq(&self, other: &ServerErrorKind) -> bool
self and other values to be equal, and is used by ==.