Ralph Hopman created FINERACT-2567:
--------------------------------------

             Summary: Fix incorrect and misleading error messages in exception 
classes
                 Key: FINERACT-2567
                 URL: https://issues.apache.org/jira/browse/FINERACT-2567
             Project: Apache Fineract
          Issue Type: Improvement
            Reporter: Ralph Hopman
            Assignee: Ralph Hopman


Several exception classes contain error messages that are incorrect, 
misleading, or contain copy-paste mistakes. These messages are returned as part 
of API error responses and seen by API clients and end users.
h2. Changes
h3. Inverted logic in error messages (user-visible)

The following error messages are the opposite of what they should say. They 
occur inside {{CannotBe*}} exception classes (exceptions that are thrown 
because an action *cannot* be performed) but the messages incorrectly state 
that the action *can* be performed.
||File||Reason constant||Current message||Fixed message||
|{{LoanChargeCannotBePayedException}}|{{LOAN_INACTIVE}}|"This loan charge *can 
be payed* as the loan associated with it is currently inactive"|"This loan 
charge *cannot be paid* as the loan associated with it is currently inactive"|
|{{LoanChargeCannotBePayedException}}|{{CHARGE_NOT_ACCOUNT_TRANSFER}}|"This 
loan charge *can be payed* as the charge payment mode is not account 
transfer"|"This loan charge *cannot be paid* as the charge payment mode is not 
account transfer"|
|{{LoanChargeCannotBePayedException}}|{{CHARGE_NOT_PAYABLE}}|"This loan charge 
is not *Payable* through account transfer"|"This loan charge is not *payable* 
through account transfer"|
|{{LoanChargeCannotBeWaivedException}}|{{LOAN_INACTIVE}}|"This loan charge *can 
be waived* as the loan associated with it is currently inactive"|"This loan 
charge *cannot be waived* as the loan associated with it is currently inactive"|
|{{LoanChargeCannotBeWaivedException}}|{{WAIVE_NOT_ALLOWED_FOR_CHARGE}}|"This 
loan charge {*}can be waived{*}"|"This loan charge {*}cannot be waived{*}"|
|{{LoanChargeWaiveCannotBeReversedException}}|{{LOAN_INACTIVE}}|"This loan 
charge *can be waived* as the loan associated with it is currently 
inactive"|"This loan charge *cannot be waived* as the loan associated with it 
is currently inactive"|
|{{LoanChargeWaiveCannotBeReversedException}}|{{WAIVE_NOT_ALLOWED_FOR_CHARGE}}|"This
 loan charge {*}can be waived{*}"|"This loan charge {*}cannot be waived{*}"|
h3. Wrong action in error message (user-visible)
||File||Current message||Fixed message||
|{{CollateralCannotBeDeletedException}}|"This collateral cannot be *updated* as 
the loan it is associated with is not in submitted and pending approval 
stage"|"This collateral cannot be *deleted* as the loan it is associated with 
is not in submitted and pending approval stage"|
|{{GLAccountInvalidUpdateException}}|"{*}This Usage of this{*} (detail) GL 
Account as it already has transactions logged against it"|"This (detail) GL 
Account cannot be updated as it already has transactions logged against it"|
h3. Inconsistent capitalisation in error messages (user-visible)
||File||Current messages||Fixed messages||
|{{PostInterestAsOnDateException}}|"Cannot Post Interest in future 
Dates"|"Cannot post interest in future dates"|
| |"Please Pass a valid date"|"Please pass a valid date"|
| |"Post Interest Date must be after the Activation date"|"Post interest date 
must be after the activation date"|
| |"Cannot Post Interest before last transaction date"|"Cannot post interest 
before last transaction date"|
h3. Copy-pasted wrong Javadoc comments (internal, not user-visible)

All of the following classes contain the identical copy-pasted comment {{{}/*** 
enum of reasons of why Loan Charge cannot be waived ***/{}}}, which is 
corrected to reflect each class's actual purpose.
 * {{LoanChargeCannotBePayedException}} → "cannot be paid"
 * {{LoanChargeCannotBeDeletedException}} → "cannot be deleted"
 * {{LoanChargeCannotBeUpdatedException}} → "cannot be updated"
 * {{CollateralCannotBeCreatedException}} → "cannot be created"
 * {{CollateralCannotBeDeletedException}} (collateral) → "cannot be deleted"
 * {{CollateralCannotBeUpdatedException}} → "cannot be updated"
 * {{CollateralCannotBeDeletedException}} (collateralmanagement) → "cannot be 
deleted"
 * {{ClientCollateralCannotBeDeletedException}} → "cannot be deleted"

h2. Impact

The user-visible message fixes affect the {{defaultUserMessage}} field in JSON 
error responses. No error codes are changed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to