Engine Exceptions

In this article

EAException

EFTException

BarcodeException

LineItemsException

EFTArgumentException

SettingException

When things go wrong LS Pay will throw exceptions. To make it simpler to handle exceptions, LS Pay has its own base exception, EngineException, and all exceptions thrown will be of this type or derive from it.

Tip: In all instances, you can access more details by viewing the error message.

LS Pay exception structure

EAException

Exceptions thrown in the EAManagement or linked with connection problems will be of the type EAException, if there is something wrong in the communication with the POS, the cardholder, or the PED. The exception class has a set of enum error codes (EAErrorCode) describing why an error was thrown and you can use these for localization in the POS.

Copy
C#
public enum EAErrorCode
{
  Unknown, // An unknown error has occured, not able to categorize it.
  DeviceIsBusy, // The device is busy.
  UnknownEAManagementType, // An unknown External Accessory Management type selected
  ConnectionTimeout, // The connection timed out before or after inital connection was made
  ConnectionInterupted, // Connection lost after initial connection was made or when request has been sent to device and no response has been received 
  FailedToConnect, // There is no connection and there was no initial connection made, can also happen when request is sent
  DevicePairingNeeded, // A pairing function is needed before this action
  PairingError, // An error occured in the pairing process
  PairingCodeMismatch, // A mismach between pairing codes
  BatteryTooLow, // The battery is too low on the device, action not possible at this moment
  SessionInProgress, // A session is already in progress
  ConfigurationError, // Configuration error
  CommuncationFailure, // Failed to send or receive a response from the PED
  CouldNotParseData, // Could not parse data from the PED
  NotSupported, // Action or process not supported
  MissingInformation, // Missing settings or any other information the device needs
  CouldNotConnectWithHostThroughTerminal, // Could not connect with host through terminal
  DLLMissing, // Could not load DLL
}

EFTException

EFT exceptions thrown will be of the type EFTException, if something occurs in the transactions for electronic fund, authorization, void, refund and so forth. The exception class has a set of enum error codes (EAErrorCode) describing why an error was thrown and you can use these for localization in the POS.

Copy
public enum EFTErrorCode
{
  Unknown, // An unknown error occured, not able to categorize
  RequestArgumentError, // An argument exception is thrown
  NoSession, // No session is active.
  FailureToStartSession, // Failed to start a session
  FailureToFinishSession, // Failed to finish a session
  TransactionNotFound, // Transaction cannot be found
  UnsupportedOperation, // Operation is not supported
  CorruptedDataReceived, // Service has received corrupted data
  UnexpectedResultReceived, // An unexpected result value was received in the response.
  NotSupported, // Not supported request sent in
  DataMissing, // Data missing that was expected
  UnexpectedDataReceived, // Data received is not what was expected
  Timeout, // Timeout while waiting for customer
  InvalidOperation, // Transaction already in progress
}

BarcodeException

Barcode exceptions thrown will be of the type BarcodeException. The exception class has a set of enum error codes (BRErrorCode) describing why an error was thrown andyou can use these for localization in the POS.

Copy
public enum BRErrorCode
{
  Denied, // Barcode connection denied
  PowerOnFailure, // Could not power on the barcode reader
  Cancelled, // Action cancelled
  Unknown // An known error occured, not able to categorize 
}

LineItemsException

Line item exceptions thrown will be of the type LineItemsException. The exception class has a set of enum error codes (LineItemErrorCode) describing why an error was thrown and you can use these for localization in the POS.

Copy
public enum LineItemErrorCode
{
  Unknown, // An unknown error occured, not able to categorize
  NoData, // No data was received
  Mismatch, // Mismatch in data given
  InvalidCobination, // Invalid combination 
  FieldRequired, // Field required
  InvalidField, // Invalid field or decoding failed
  Exists, // Line item already exists
  NotExists, // Line item does not exist
  InvalidValue, // Not valid value for field
  CannotBeNegative, // Field value cannot be negative
  MustBeGreaterThan // Field value must be greater than 0
}

EFTArgumentException

The argument exception as an inner exception of EFTException. The exception class has two additional variables:

  • ParamName of the type enum
  • ActualValue holding information regarding why the error is thrown.
Copy
public enum ParamName
{
  CurrencyCode, 
  AmountBreakdown,
  TotalAmount,
  CashbackAmount,
  TipAmount,
  TransactionType,
  TransactionId,
  EFTTransactionId,
  AdditionalId,
  Other,
  Surcharge,
}

Example: Catch ArgumentException in Android application:

Copy
try
{
  updateResult = settings.UpdateValue(setting.Key, editBox.Text);
}
catch (ArgumentException ae)
{
  using (var builder = new AlertDialog.Builder(this))
  {
    builder.SetMessage(ae.Message);
    builder.SetPositiveButton("OK", (s, a) => { });
    var myCustomDialog = builder.Create();
    myCustomDialog.Show();
  }
}

SettingException

Setting exceptions thrown will be of the type SettingException. The exception class has a set of enum error codes (SettingErrorCode) describing why an error was thrown and you can use these for localization in the POS.

Copy
public enum SettingErrorCode
{
  InvalidKey, // An invalid key was sent in, not recognised
  DataTypeMismatch, // Wrong type of data received
  ReadOnly, // Value is read only, not possible to alter
  Unknown,
}