Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0043608Openbravo ERPA. Platformpublic2020-03-30 13:342020-04-16 11:25
vmromanos 
alostale 
normalmajoralways
closedfixed 
5
 
PR20Q3 
caristu
Core
No
0043608: failed process definition execution not shown in UI
When a process definition execution fails by throwing an exception, no message is displayed to the user.

There are 2 different cases:

* Case 1: failed DAL's DB trx
If current DAL's DB transaction fails, ie. a trigger raised an exception while executing the process, the process was kept in PROCESSING from UI.

* Case 2: any other exception
When any other exception is thrown, no info is displayed at all (not error nor success message).
Case 1
1 - Create a trigger in the invoice line table with a single line where an exception is thrown, example RAISE EXCEPTION '%', '@SomeErrorMessage@'; --OBTG:-20000--
2 - Create a Purchase Invoice header.
3 - Create lines using the selector "Create lines from Order"

Error message is not displayed on selector (see attached image)

Case 2:
1 - In CreateInvoiceLinesFromHandler throw an exception before doing anything
2 - Create a Purchase Invoice header.
3 - Create lines using the selector "Create lines from Order"

Process popup is closed without displaying any info about the process execution status
No tags attached.
related to defect 0043581PR20Q4 closed vmromanos selector "Create lines from Order" in "Purchase Invoice" does not show trigger's errors. 
Issue History
2020-03-30 13:34vmromanosNew Issue
2020-03-30 13:34vmromanosAssigned To => platform
2020-03-30 13:34vmromanosModules => Core
2020-03-30 13:34vmromanosResolution time => 1586901600
2020-03-30 13:34vmromanosTriggers an Emergency Pack => No
2020-03-30 13:34vmromanosIssue generated from0043581
2020-03-30 13:34vmromanosRelationship addedrelated to 0043581
2020-03-30 13:51vmromanosNote Added: 0118874
2020-03-30 13:51vmromanosRelationship replacedblocks 0043581
2020-03-30 13:56vmromanosNote Edited: 0118874bug_revision_view_page.php?bugnote_id=0118874#r20638
2020-03-30 14:10PracticsIssue Monitored: Practics
2020-03-31 12:55vmromanosRelationship replacedrelated to 0043581
2020-04-03 11:54alostaleResolution time1586901600 =>
2020-04-03 11:54alostaleNote Added: 0118937
2020-04-03 12:00alostaleSummaryselector "Create lines from Order" in "Purchase Invoice" does not show trigger's errors. => failed process definition execution not shown in UI
2020-04-03 12:00alostaleDescription Updatedbug_revision_view_page.php?rev_id=20682#r20682
2020-04-03 12:00alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20684#r20684
2020-04-03 12:00alostaleNote Added: 0118938
2020-04-09 10:52alostaleAssigned Toplatform => alostale
2020-04-09 12:10hgbotCheckin
2020-04-09 12:10hgbotNote Added: 0119114
2020-04-09 12:10hgbotStatusnew => resolved
2020-04-09 12:10hgbotResolutionopen => fixed
2020-04-09 12:10hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1f9c2cc10bed2494df1540eb668b4b299cf83a07 [^]
2020-04-09 12:10alostaleReview Assigned To => caristu
2020-04-16 11:25caristuNote Added: 0119213
2020-04-16 11:25caristuStatusresolved => closed
2020-04-16 11:25caristuFixed in Version => 3.0PR20Q3

Notes
(0118874)
vmromanos   
2020-03-30 13:51   
(edited on: 2020-03-30 13:56)
This issue is a clone from 0043581 to fix the platform side.

The functional code seems to be OK. In CreateInvoiceLinesFromHandler, the method showExceptionInViewAndRetry() properly builds the JSONObject with an error message and it allows to retryExecution.
For example, when you select no lines from the grid, this method properly shows the expected error and allows the execution.
However, when the error comes from the DB, the popup is locked as in the 0043581 attached screenshot.

In browser console I can see the errors:

POST http://localhost:8080/openbravo/org.openbravo.client.kernel?processId=AB2EFCAABB7B4EC0A9B30CFB82963FB6&reportId=null&windowId=183&_action=org.openbravo.common.actionhandler.createlinesfromprocess.CreateInvoiceLinesFromOrderLines [^] 500
isc_c_Comm_sendXmlHttpRequest @ ISC_Combined.js:1051
isc_c_RPCManager__sendQueue @ ISC_Combined.js:11592
isc_c_RPCManager_sendQueue @ ISC_Combined.js:11547
isc_c_RPCManager_sendRequest @ ISC_Combined.js:11430
call @ ff67f802d8c2e29736a69cb8994fa606.js:1507
actionHandlerCall @ ff67f802d8c2e29736a69cb8994fa606.js:3184
doProcess @ ff67f802d8c2e29736a69cb8994fa606.js:3184
actionClick @ ff67f802d8c2e29736a69cb8994fa606.js:3161
isc_StatefulCanvas_handleActivate @ ISC_Combined.js:3562
isc_StatefulCanvas_handleClick @ ISC_Combined.js:3563
isc_c_EventHandler_bubbleEvent @ ISC_Combined.js:1337
isc_c_EventHandler_handleClick @ ISC_Combined.js:1203
isc_c_EventHandler__handleMouseUp @ ISC_Combined.js:1192
isc_c_EventHandler_handleMouseUp @ ISC_Combined.js:1186
isc_c_EventHandler_dispatch @ ISC_Combined.js:1411
eval @ VM39185:3

Uncaught TypeError: _3.match is not a function
    at _2.isc_c_RPCManager_evalResult [as _originalEvalResult] (ISC_Combined.js:11707)
    at _2.evalResult (ff67f802d8c2e29736a69cb8994fa606.js:180)
    at _2.isc_c_RPCManager_fireReplyCallbacks [as fireReplyCallbacks] (ISC_Combined.js:11710)
    at _2.isc_c_RPCManager_performOperationReply [as performOperationReply] (ISC_Combined.js:11704)
    at _2.isc_c_RPCManager__performTransactionReply [as $39d] (ISC_Combined.js:11689)
    at _2.isc_c_RPCManager_performTransactionReply [as _originalperformTransactionReply] (ISC_Combined.js:11621)
    at _2.performTransactionReply (ff67f802d8c2e29736a69cb8994fa606.js:181)
    at eval (eval at isc__makeFunction (ISC_Combined.js:45), <anonymous>:3:16)
    at _2.isc_c_Class_fireCallback [as fireCallback] (ISC_Combined.js:254)
    at _2.isc_c_Comm_performXmlTransactionReply [as performXmlTransactionReply] (ISC_Combined.js:1055)





My feeling, however, is that the problem comes from the database.

When there is an exception in database the transaction is blocked and it doesn't allow new queries to the database. For example, it is impossible to retrieve the message text from the AD_Message. You can debug the OBMessageUtils.messageBD("error") and you will realize that when we try to retrieve the message after an exception in a trigger, the messageDB() execution shows the exception "ERROR: transacción abortada, las órdenes serán ignoradas hasta el fin de bloque de transacción".

Obviously this is a generic problem that must be fixed, because it avoids to show to the user the translated message. But my feeling is that this is the root cause for the lock in the popup.

(0118937)
alostale   
2020-04-03 11:54   
Removing OBPS and SLA as the initial issue is fixed by 0043581
(0118938)
alostale   
2020-04-03 12:00   
MR: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/55/diffs [^]
(0119114)
hgbot   
2020-04-09 12:10   
Repository: erp/devel/pi
Changeset: 1f9c2cc10bed2494df1540eb668b4b299cf83a07
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Apr 03 11:47:15 2020 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/1f9c2cc10bed2494df1540eb668b4b299cf83a07 [^]

fixed BUG-43608: failed process execution does not display error to user

When a process definition execution raises an error, error message is
not seend in the UI.

There were 2 cases:
* An exception is thrown due to DB error in a DAL operation -> now we
  rollback current transacation as it failed in any case, this prevents
  trying to reuse an already rolled back DB trx.
* Any other execption, it was already caught but an emtpy JSON object
  without any info was sent to client -> now we try to generate a user
  readable message or at least to show the technical cause.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/process/BaseProcessActionHandler.java
---
(0119213)
caristu   
2020-04-16 11:25   
Reviewed + tested OK