Validation exception messages in three tier are pretty unhelpful by the time they get to the client. We've been extending them by adding this to ValidationException:

    /**
* Returns message that includes the details of the validation failures.
     */
    public String getMessage() {
        String message = super.getMessage();
        if (result.hasFailures()) {
            message = message + " validation failures: ";
            for (int i = 0; i < result.getFailures().size(); i++) {
message = message + ((ValidationFailure) result.getFailures().get(i)).toString();
                if (i < result.getFailures().size() - 1) {
                    message = message + ", ";
                }
            }
        }
        return message;
    }


Any thoughts about side effects this might have for anyone?


As an aside, what would be even more helpful is if three tier returned not a CayenneRuntimeException, but a ValidationException to the client. I don't know if that is hard to change.


Ari





-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A


Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to