harry-g / fairpos

Automatically exported from code.google.com/p/fairpos
0 stars 0 forks source link

articles: readable error message #58

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Errors in article panel are not readable.
E.g. for missing mandatory field, there is just an exception and only in 
details the reason can be found.

Original issue reported on code.google.com by harald.g...@gmail.com on 13 Mar 2012 at 10:57

GoogleCodeExporter commented 8 years ago

Original comment by harald.g...@gmail.com on 21 Jun 2012 at 8:03

GoogleCodeExporter commented 8 years ago

Original comment by harald.g...@gmail.com on 22 Jun 2012 at 9:03

GoogleCodeExporter commented 8 years ago
Please provide more detail...

Exceptions are coming from PSQL, we cannot probably alter/extend them in 
postgre...
You want to parse exception message & show only some relevant information? Or 
better, recognize the message & construct appropriate localized message? Change 
also window title? Disable printing message (for non-admin users?)?

I have access to the window & that exception msg. as shown marked on pic.

Breakpoint here:
* JMessageDialog.java - showMessage()
* JSaver.java - jbtnNewActionPerformed()

Original comment by benes.vi...@gmail.com on 26 Jun 2012 at 10:26

Attachments:

GoogleCodeExporter commented 8 years ago
I was thinking about recognizing and mapping the exceptions to dedicated 
localized messages.
The window title could be some generic thing like "Error".

Original comment by harald.g...@gmail.com on 27 Jun 2012 at 9:43

GoogleCodeExporter commented 8 years ago
Let's postpone this to productive milestone. There are more important ones.

Original comment by harald.g...@gmail.com on 7 Jul 2012 at 9:53

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Three types of Exceptions were identified (see attached file):
 a) (adding) missing value in required field
 b) (adding) value is already in db & it must be unique
 c) (removing) entry in other table references key (foreign key violation)

Repro: 
In FairPOS app, log as admin, go to one of:
* Maintenance -> Users
* Stock -> Products
* Stock -> Categories
* Customers -> Customers
& try to add there entries without required fields / duplicated entries 
or try to delete category.

Replacing to more user-friendly messages implemented:
r132 (& subsequent cosmetics)

Original comment by benes.vi...@gmail.com on 24 Jan 2013 at 10:21

Attachments:

GoogleCodeExporter commented 8 years ago
Problem was that PostgreSQL localizes messages and there is no unique error ID 
it seems.
I now tried to only look for some keywords not translated (ignore case, as even 
this is different):
- "unique" "constraint"
- "null" "constraint"
- "constraint" and NOT above = foreign key constraint

That works so far.
Same for fiels/table names.
Also refactored it a bit and imporved the german messages.

What still fails is the first table name. 
The line
 String tab0 = getLabelForDbField( str.replaceAll(".* [»\"]", "").replaceAll("[«\"].*","") );
somehow always finds the last instead of the first table name.
Maybe you can have a look - i spent too much time on it now...

Attached fyi the german messages.

Original comment by harald.g...@gmail.com on 2 Feb 2013 at 5:49

GoogleCodeExporter commented 8 years ago

Original comment by harald.g...@gmail.com on 2 Feb 2013 at 6:15

Attachments:

GoogleCodeExporter commented 8 years ago
r142 removed detail button, not needed

Original comment by harald.g...@gmail.com on 7 Feb 2013 at 4:39

GoogleCodeExporter commented 8 years ago
r150 
DB names should be correct now.

Original comment by benes.vi...@gmail.com on 10 Feb 2013 at 5:05

GoogleCodeExporter commented 8 years ago
Works fine!
But leaving this open for later milestone, as it is not language-independent.
Imagine using this for czech language... and adding more and more languages =:-O

Original comment by harald.g...@gmail.com on 10 Feb 2013 at 5:30

GoogleCodeExporter commented 8 years ago

Original comment by harald.g...@gmail.com on 10 Feb 2013 at 5:30