Catch CommitException outside of CommitHandler

Hi there,

where can I catch the thrown commit exception from my own CommitHandler?
[code]
grid.getEditorFieldGroup().addCommitHandler(new CommitHandler() {
@Override
public void preCommit(CommitEvent commitEvent) throws CommitException {
}

        @Override
        public void postCommit(CommitEvent commitEvent) throws CommitException {
            // validations...
            boolean failed = true;
            if (failed) {
                // the message I want to display as a notification
                throw new CommitException("Commit failed...");
            }
        }
    });

[/code]
Right now it shows the error indicator on the grid but I just want to show my own Notification. Any hints?

Thanks in advance!

Can somebody please help me on that one? It’s probably obvious but I can’t figure out how to catch my own thrown CommitException outside of the commit handler… or is it maybe just the wrong approach?

Any help would be greatly appreciated!

I’m one step further… I just found out about the EditorErrorHandler.

setEditorErrorHandler(new EditorErrorHandler() { @Override public void commitError(CommitErrorEvent inEvent) { //inEvent.getUserErrorMessage(); } }); This works, but I can’t seem to transmit my own message in the CommitException (thrown inside the void postCommit())… it always uses the “Commit failed” message from the FieldGroup.class.
Do I really need to override the commit() function and thus build my own FieldGroup or is there an easier way?

  public void commit() throws CommitException {
        if (!isBuffered()) {
            // Not using buffered mode, nothing to do
            return;
        }

        startTransactions();

        try {
            firePreCommitEvent();

            Map<Field<?>, InvalidValueException> invalidValueExceptions = commitFields();

            if (invalidValueExceptions.isEmpty()) {
                firePostCommitEvent();
                commitTransactions();
            } else {
                throw new FieldGroupInvalidValueException(
                        invalidValueExceptions);
            }
        } catch (Exception e) {
            rollbackTransactions();
            throw new CommitException("Commit failed", this, e);
        }

    }