Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Revisions: Issue #54673 Back to Issue ]
Summary 0054673: Errors in successful responses generate a notification even if the code that issued the request handles the error.
Revision 2024-07-12 14:02 by AugustoMauch
Description When a successful response contains an error message, the error is handled on a function listener here [1] and a notification is displayed on the lower part of the screen (see attached image).

Sometimes the code that issued the request is the one that is going to address the error (see same attached image), so the notification displayed by the RequestListener would not be needed, as it is redundant.

[1] https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/blob/master/web-jspack/org.openbravo.core2/src/core/network/RequestListener.js#L42 [^]
Revision 2024-07-12 13:47 by AugustoMauch
Description Currently, the exceptions generated in the backoffice are handled and this leads to some issues when the developers need to handle themselves in other code parts. This exception handling mechanism should be controlled or erased and let the developers that implement new code handle their exceptions.
Here is an example of the issue:
We are trying to show an error on a dialog but we always get the general popup error too. (image attached)
Revision 2024-07-12 13:47 by guilleaer
Steps To Reproduce In org.openbravo.pos2/src/org/openbravo/pos2/process/StoreStock.java add throw exception

--- a/src/org/openbravo/pos2/process/StoreStock.java
+++ b/src/org/openbravo/pos2/process/StoreStock.java
@@ -22,6 +22,7 @@ import javax.inject.Inject;
 import org.apache.commons.lang.StringUtils;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
 import org.openbravo.client.kernel.ComponentProvider.Qualifier;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
@@ -62,6 +63,9 @@ public class StoreStock extends ProcessHQLQuery {
 
   @Override
   protected Map<String, Object> getParameterValues(JSONObject jsonsent) throws JSONException {
+ if (1 == 1) {
+ throw new OBException("My managed error");
+ }
     try {
       OBContext.setAdminMode(true);
       final Map<String, Object> parameters = new HashMap<>();



In /home/openbravo/workspaces/pos2/openbravo/modules/org.openbravo.pos2/web-jspack/org.openbravo.pos2/src/components/ProductButton/StoreStockPopup/StoreStockDataSource.js add a console log to simulate that I want to manage my exception

--- a/web-jspack/org.openbravo.pos2/src/components/ProductButton/StoreStockPopup/StoreStockDataSource.js
+++ b/web-jspack/org.openbravo.pos2/src/components/ProductButton/StoreStockPopup/StoreStockDataSource.js
@@ -29,6 +29,8 @@ export default class StoreStockDataSource extends RemoteDataSource {
       productId
     });
 
+ console.error('My Own error');
+

Login into POS
Add a product to the order -> Avalanche transceiver
click on the line recently added -> It executes to call to check stock

1. Error with my exception is shown as an error
2. my log is shown in the console

Platform should allow developers to manage exceptions without showing errors

Revision 2024-07-12 09:32 by guilleaer
Steps To Reproduce -


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker