Package com.storedobject.common
Class Fault
java.lang.Object
com.storedobject.common.Fault
Represents a fault or error condition in the system.
This class provides methods to retrieve information about the fault, replace the fault message or code,
and append additional information to the fault message.
- Author:
- Syam
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FaultIndicates that an account with the same identifier already exists.static final FaultIndicates that the requested account could not be found.static final FaultIndicates that the account identifier was not provided.static final FaultIndicates that an action was required but not specified.static final FaultIndicates that the requested customer could not be found.static final FaultIndicates that a duplicate entry was found.static final FaultIndicates that a duplicate reference was found.static final FaultIndicates that a narration is required but was not provided.static final FaultIndicates that the external system is not recognized.static final FaultIndicates that access is illegal or prohibited.static final FaultIndicates that an amount value is invalid.static final FaultIndicates that a currency value is invalid.static final FaultIndicates that a date value is invalid.static final FaultIndicates that a period value is invalid.static final FaultIndicates that multiple entries were found where a single entry was expected.static final FaultIndicates that no entries were found.static final FaultIndicates that the account is not a customer account.static final FaultIndicates that the account is not a deposit account.static final FaultIndicates that the account is not a general ledger account.static final FaultIndicates that the account is not a loan account.static final FaultIndicates that the current operation is not allowed.static final FaultIndicates that the available balance is insufficient for the requested operation.static final FaultIndicates that the one-time password does not match.static final FaultIndicates that only part of the transaction was committed.static final FaultIndicates that a reference with the same value already exists.static final FaultIndicates that the requested reference could not be found.static final FaultIndicates that the reference identifier was not provided.static final FaultA technical fault indicating an unexpected internal error.static final FaultIndicates that transaction approval failed.static final FaultIndicates that a transaction is not balanced.static final FaultIndicates that the requested transaction could not be found.static final FaultA fallback fault used when no specific category applies to the error.static final FaultIndicates that the requested action is not recognized.static final FaultIndicates that the requested voucher could not be found. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends a message to the existing fault message with a default separator.Appends the given message to the current message using the specified delimiter.intgetCode()Retrieves the code value associated with this object.Retrieves the message associated with this method.booleanChecks if this fault is categorized.booleanChecks if this fault is technical.replace(int code) Replaces the code of the Fault with the given code and returns the updated Fault object.Replaces the message of a Fault object.
-
Field Details
-
TECHNICAL_FAULT
A technical fault indicating an unexpected internal error.Use this when the failure is not caused by invalid user input or a business-rule violation.
-
UNCATEGORIZED_FAULT
A fallback fault used when no specific category applies to the error. -
ACCOUNT_ALREADY_EXISTS
Indicates that an account with the same identifier already exists. -
ACCOUNT_NOT_FOUND
Indicates that the requested account could not be found. -
ACCOUNT_NOT_SPECIFIED
Indicates that the account identifier was not provided. -
CUSTOMER_NOT_FOUND
Indicates that the requested customer could not be found. -
NOT_A_CUSTOMER_ACCOUNT
Indicates that the account is not a customer account. -
NOT_A_LOAN_ACCOUNT
Indicates that the account is not a loan account. -
NOT_A_DEPOSIT_ACCOUNT
Indicates that the account is not a deposit account. -
NOT_A_GL_ACCOUNT
Indicates that the account is not a general ledger account. -
INVALID_DATE
Indicates that a date value is invalid. -
INVALID_PERIOD
Indicates that a period value is invalid. -
INVALID_AMOUNT
Indicates that an amount value is invalid. -
INVALID_CURRENCY
Indicates that a currency value is invalid. -
TRANSACTION_APPROVAL_ERROR
Indicates that transaction approval failed. -
TRANSACTION_NOT_BALANCED
Indicates that a transaction is not balanced. -
TRANSACTION_NOT_FOUND
Indicates that the requested transaction could not be found. -
PARTIAL_TRANSACTION_COMMITTED
Indicates that only part of the transaction was committed. -
NOT_ENOUGH_BALANCE
Indicates that the available balance is insufficient for the requested operation. -
EMPTY_NARRATION
Indicates that a narration is required but was not provided. -
VOUCHER_NOT_FOUND
Indicates that the requested voucher could not be found. -
ACTION_NOT_SPECIFIED
Indicates that an action was required but not specified. -
UNKNOWN_ACTION
Indicates that the requested action is not recognized. -
DUPLICATE_ENTRY_FOUND
Indicates that a duplicate entry was found. -
NO_ENTRIES_FOUND
Indicates that no entries were found. -
MULTIPLE_ENTRIES_FOUND
Indicates that multiple entries were found where a single entry was expected. -
DUPLICATE_REFERENCE_FOUND
Indicates that a duplicate reference was found. -
REFERENCE_NOT_FOUND
Indicates that the requested reference could not be found. -
REFERENCE_ALREADY_EXISTS
Indicates that a reference with the same value already exists. -
REFERENCE_NOT_SPECIFIED
Indicates that the reference identifier was not provided. -
NOT_ALLOWED
Indicates that the current operation is not allowed. -
ILLEGAL_ACCESS
Indicates that access is illegal or prohibited. -
OTP_MISMATCH
Indicates that the one-time password does not match. -
EXTERNAL_SYSTEM_NOT_RECOGNIZED
Indicates that the external system is not recognized.
-
-
Constructor Details
-
Fault
Represents a fault with an error code and a descriptive message.- Parameters:
code- the error code associated with the faultmessage- the descriptive message of the fault
-
-
Method Details
-
getCode
public int getCode()Retrieves the code value associated with this object.- Returns:
- The code value.
-
getMessage
Retrieves the message associated with this method.- Returns:
- The message string.
-
replace
-
replace
Replaces the code of the Fault with the given code and returns the updated Fault object.- Parameters:
code- the new code to be set in the Fault- Returns:
- the updated Fault object with the new code and the same message as the original Fault
-
append
-
append
Appends the given message to the current message using the specified delimiter.- Parameters:
message- the message to be appendeddelimiter- the delimiter to be used for joining the current message and the given message- Returns:
- a new Fault object with the updated message
-
isCategorized
public boolean isCategorized()Checks if this fault is categorized.- Returns:
trueif the fault is categorized,falseotherwise.
-
isTechnical
public boolean isTechnical()Checks if this fault is technical.- Returns:
- true if this is technical, false otherwise.
-