You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org> on 2007/07/12 06:46:04 UTC

[jira] Created: (OFBIZ-1141) More user friendly error messages

More user friendly error messages
---------------------------------

                 Key: OFBIZ-1141
                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
             Project: OFBiz
          Issue Type: Improvement
    Affects Versions: SVN trunk, Release Branch 4.0
            Reporter: Wickersheimer Jeremy
            Priority: Minor


A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.

This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
In that case the error is something like:

ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]

It is fine for a developer who can understand that, but not for a user.

I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:

ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.

Or better:

ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."

I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513189 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

I dove into the code and found the exception birth into SQLProcessor.
We can get the type of error with SQLState but extracting the actual data need regex-ing the exception text which is not so pretty.

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OFBIZ-1141) More user friendly error messages

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-1141.
----------------------------------

       Resolution: Incomplete
    Fix Version/s: SVN trunk
         Assignee: Jacques Le Roux

Seems incomplete to me. Please reopen if you thing otherwise...

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: accounting, framework
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch, ofbiz-1141-example3.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512040 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

To be honest i don't like it either, it is just something that we should be able to do without needing to add ~100 loc in each service definition.
The patch i put in our server is even more big, and i certainly do not see myself having to do the same on a bazillion other services.

The ugliness in the patch shows that there is something lacking in the framework to handle those cases. 
Maybe some try/catch mechanism.

There is certainly a lot to improve in the field of error handling, so i wanted to open that issue and see if maybe some ofbiz wizard could do the same as this patch in just a few lines. :)

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512880 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

I have the following working: the validation code is not the ugly conditions pyramid like before but the more readable:

       <!--we need to check that Party Id exists manually-->
        <check-primary-key entity-name="Party" ignore-empty="true">
            <primary-key field-name="partyId" env-name="parameters.partyIdFrom" />
            <fail-message message="The Party '${parameters.partyIdFrom}' doesn't exist"/>
        </check-primary-key>
        <check-primary-key entity-name="Party" ignore-empty="true">
            <primary-key field-name="partyId" env-name="parameters.partyIdTo" />
            <fail-message message="The Party '${parameters.partyIdTo}' doesn't exist"/>
        </check-primary-key>
        <check-errors/>
        <!--check for product Id-->
        <check-primary-key entity-name="Product" ignore-empty="true">
            <primary-key field-name="productId" env-name="parameters.productId" />
            <fail-message message="The Product '${parameters.productId}' doesn't exist"/>
        </check-primary-key>
        <check-errors/>
        <!--check for FK violation-->
        <check-primary-key entity-name="PartyRole" ignore-partial="true">
            <primary-key field-name="partyId" env-name="parameters.partyIdFrom" />
            <primary-key field-name="roleTypeId" env-name="parameters.roleTypeIdFrom" />
            <fail-message message="The Party '${parameters.partyIdFrom}' doesn't have the Role Type '${parameters.roleTypeIdFrom}'"/>
        </check-primary-key>
        <check-primary-key entity-name="PartyRole" ignore-partial="true">
            <primary-key field-name="partyId" env-name="parameters.partyIdTo" />
            <primary-key field-name="roleTypeId" env-name="parameters.roleTypeIdTo" />
            <fail-message message="The Party '${parameters.partyIdTo}' doesn't have the Role Type '${parameters.roleTypeIdTo}'"/>
        </check-primary-key>
        <check-errors/>

There is far less code per validation now, but it is still a bit tedious to rewrite (or write, partyId validation wasn't working) each validation condition.
Also in that case i need to duplicate this block of code in both create and update.

Now this reminds me of how validation is done in Ruby On Rails, we could do something similar:
- validation conditions written in the model definition (entity definition), with localized error messages
- validation done automatically before update / create is passed to the database thus supplementing but not replacing the DB FK checks.

If think this would be even more elegant !


> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wickersheimer Jeremy updated OFBIZ-1141:
----------------------------------------

    Attachment: ofbiz-1141-example2.patch

Here is the patch corresponding to the second approach.
This add a new simple-method test:
- framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPrimaryKey.java
- framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java
- framework/minilang/dtd/simple-methods.xsd

Then to illustrate how it would be used i patched:
- applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml

Disregarding the content of the error message which may or may not be accurate, you will agree this is less ugly than the first example.

Now I will work on a the third approach i described earlier: 
- write those validations in the entity description
- call the validation methods inside the <create-value> and <store-value> so that the service definitions remains unchanged
- probably add an attribute "skip-validation" for those tags so that we can disable the new behavior when it causes problem, or just on purpose in some cases.


> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513426 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

I managed to write an exception interceptor.
I wrote a small utility class that does the parsing from the Exception object, then i added 3 lines of code in StoreValue.java (the simple ethod used to update an entity, the same can be done in CreateValue) to call the interceptor and replace the error message when the parsing is successful.

This can effectively replace any FK violation error message (simple or multiple K) by for example:
   The party_role 'Company,CAL_ORGANIZER' doesn't exist.

I will post the patch after lunch so you can have a check, then i will add support for localized messages.

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wickersheimer Jeremy updated OFBIZ-1141:
----------------------------------------

    Attachment: ofbiz-1141-example3.patch

This illustrates the Exception interception approach.
- there is a custom utility class (UtilException) in entity.util [this can be chnage to whatever more convenient/standard location/name]
- then a small patch of StoreValue and CreateValue to process the Exception and if it could be handled by UtilException changes the message to be displayed to the one built by UtilException

As i feared the parsing will have to adapt to different DB systems, for example in Postgres the message contains the Detail of the FK violation which means i can retrieve the Table where the data is missing.. but in Derby i don't have that information so i adapted the code to fallback to the simple FK violation description which in both cases only gives me the Values and the FK name.

If people are interested they can try with other DBs (MySQL, Oracle, ...) 

It also relies on the SQLState which should be 23503 for a FK violation, i read that some version of MySQL returns 23000 for all 23*** states...
But anyway, if the state doesn't match OR the regex fail, then it falls back to the previous behavior.

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch, ofbiz-1141-example3.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534340 ] 

Si Chen commented on OFBIZ-1141:
--------------------------------

Hey guys -

I think this is something which would be very helpful, but maybe we should take a look at the Spring Framework's data access exception methods:
http://www.theserverside.com/tt/articles/article.tss?l=SpringFramework


> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch, ofbiz-1141-example3.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512869 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

I am working on a simple-method that can check for the existence of an entity given its PK. 
If the entity is not found a message can be displayed with "fail-message" or "fail-property".

Basically i want to make it flexible enough to be used in other cases.

BTW: there seem to be a bug on the agreement creation, apart from the FK issue, it seems that no check is made at all when just a PartyId is given (and no RoleTypeId), but then the PartyId is not checked and may not exist in the Party table (you can try by entering junk)


> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OFBIZ-1141) More user friendly error messages

Posted by "Marco Risaliti (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marco Risaliti updated OFBIZ-1141:
----------------------------------

    Component/s: framework
                 accounting

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: accounting, framework
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch, ofbiz-1141-example3.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wickersheimer Jeremy updated OFBIZ-1141:
----------------------------------------

    Attachment: ofbiz-1141-example1.patch

Here is an example for the Agreement creation. This adds a few check in the service createAgreement : check that the foreign key is valid.

I use a slightly improved version on our development server: i also display the list of valid Role Type Id for the Party Id that had a mismatch.
This required a small addition in the StringUtil to parse the string of a list of Entities and get the RoleTypeId.

But the basic idea is there.

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "David E. Jones (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512026 ] 

David E. Jones commented on OFBIZ-1141:
---------------------------------------

Just a warning, and nothing personal, but I don't like this patch for a couple of reasons:

1. the messages are not quite correct and may be confusing; it's not that they "do not match", the problem is the Party isn't in the given Role

2. we really need to find a better way to do this as this technique has a huge impact on both code volume and performance; in other words it would make the code significantly more difficult to read and maintain (and to write if we made it a standard practice), and with 2 extra database round trips it also slows down the service quite a bit

To be clear, I'm 100% opposed to this patch, but I also think this is a good direction to start going. We should develop something a little easier to use and without any performance impact, like something that "translates" lower level error messages or something.



> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "David E. Jones (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513144 ] 

David E. Jones commented on OFBIZ-1141:
---------------------------------------

This is an interesting concept Jeremy, but I think it needs more work before we adopt it across the project as a recommended approach.

Again the main objectives I have for this are:

1. minimal coding overhead
2. minimal performance overhead

For #1 we could really reduce coding overhead by checking all foreign keys and primary keys automatically as part of the Entity Engine, but I'm really against that because of the performance overhead.

For the example you showed here I think because of #2 it is not acceptable. The performance hit if we pre-validated all primary and foreign keys like this (which we would HAVE to do in order to not get these ugly error messages) would be enormous and would defeat the purpose of having these done in the database where they can be faster and avoid the network round trips.

As I mentioned before the only approach I've seen that is acceptable for this is to add something to interrupt the exceptions coming back from the database and present them in a more friendly way. That is probably best done all the time as part of the Entity Engine.

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513149 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

Yes i am exploring the possibilities.

A third approach could do as you say if we could add, perhaps in the entity definition, that one FK exception should translate in one custom localized error message.

> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513160 ] 

Wickersheimer Jeremy commented on OFBIZ-1141:
---------------------------------------------

Just to clarify:
"For the example you showed here I think because of #2 it is not acceptable. The performance hit if we pre-validated all primary and foreign keys like this (which we would HAVE to do in order to not get these ugly error messages) would be enormous and would defeat the purpose of having these done in the database where they can be faster and avoid the network round trips. "

The point is NOT to duplicate the database FK checks. When a form provides sufficient facilities to enter a FK there is no need to revalidate all FKs. 
For example there is no need to verify that the RoleTypeId is valid since it is provided in a combobox already listing valid Ids.
It also SHOULDN'T be necessary to validate the PartyId like i did, but the system here fails to check that during the creation of the entity, be it a bug or on purpose.

The point is merely to workaround missing facilities in the forms. For example multiple fields FK cannot be handled properly, it would require some AJAX magic:
enter field1 -> generate a combobox for field2 with matching values, and vice versa
But that would require an even more expensive and systematic DB round-trip.

I will see if i can translate simple FK violation exceptions. I hope i can be done in a db-agnostic way, but i doubt it, exception are coming from the DB ..


> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1141) More user friendly error messages

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513389 ] 

Adrian Crum commented on OFBIZ-1141:
------------------------------------

Maybe I'm missing the point, but it seems to me you could do validation checks before you call the service code - via the <permission-service> service element.

The approach I use at work is to have the lower level logic assume all of its arguments are valid - validation is left to the presentation layer or somewhere higher up in the chain.


> More user friendly error messages
> ---------------------------------
>
>                 Key: OFBIZ-1141
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1141
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Wickersheimer Jeremy
>            Priority: Minor
>         Attachments: ofbiz-1141-example1.patch, ofbiz-1141-example2.patch
>
>
> A lot of error messages in Ofbiz are "cryptic" for normal users. For example sometimes a user would trigger a database foreign key violation and as a result will have a quite big error message thrown at him.
> This would happen for example when you create an Agreement then gives both a Party Id To and a Role Type Id To that doesn't  match. 
> In that case the error is something like:
> ERROR: Could not complete the Create an Agreement [file:/home/jeremy/bertelsmann/dgerp/applications/accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreement] process [problem creating the newEntity value: Exception while inserting the following entity: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (while inserting: [GenericEntity:Agreement][agreementDate,null()][agreementId,10076(java.lang.String)][agreementTypeId,null()][createdStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][createdTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][defaultCurrencyUomId,null()][description,null()][fromDate,2007-07-12 12:33:38.285(java.sql.Timestamp)][fromPartyClassGroupId,null()][lastUpdatedStamp,2007-07-12 12:33:38.285(java.sql.Timestamp)][lastUpdatedTxStamp,2007-07-12 12:33:38.283(java.sql.Timestamp)][partyIdFrom,null()][partyIdTo,Admin(java.lang.String)][productId,null()][roleTypeIdFrom,null()][roleTypeIdTo,PERSON_ROLE(java.lang.String)][statusId,null()][textData,null()][thruDate,null()][toPartyClassGroupId,null()] (SQL Exception while executing the following:INSERT INTO public.AGREEMENT (AGREEMENT_ID, PRODUCT_ID, PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO, AGREEMENT_TYPE_ID, AGREEMENT_DATE, FROM_DATE, THRU_DATE, DESCRIPTION, TEXT_DATA, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, STATUS_ID, DEFAULT_CURRENCY_UOM_ID, FROM_PARTY_CLASS_GROUP_ID, TO_PARTY_CLASS_GROUP_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "agreement" violates foreign key constraint "agrmnt_tprtyrle"
> Detail: Key (party_id_to,role_type_id_to)=(Admin,PERSON_ROLE) is not present in table "party_role".)))]
> It is fine for a developer who can understand that, but not for a user.
> I agree that with some hacking or better design in the forms it would be possible to avoid that kind of error, but the idea would be to be able to catch that and replace the error we something more understandable, for example:
> ERROR: the "Party Id To" doesn't have the "Role Type To Id" you entered.
> Or better:
> ERROR: the "Party Id To: Admin" doesn't have the "Role Type To Id: Person". Possible values for the Role Type are : "..."
> I know that such a feature cannot be implemented in the framework directly because errors are context sensitive, so it would have to be done in the Service XML definition.
> Perhaps some new methods could be added in simple-methods to make that task easier ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.