RPCManager.handleError bug in 7.0beta

Hello,

In 7.0beta, it appears that RPCManager.handleError() does not get invoked client-side if we call dsResponse.setFailure() and then call dsResponse.addError() server side. In 6.5.1, handleError() does get invoked client side as expected in that scenario.

It appears that handleError does get invoked in 7.0 beta if there is no call to dsResponse.addError() server-side. So, calling dsResponse.addError() server-side seems to be messing things up somehow.

Whether this happens should be specific to the component initiating the request and whether it has willHandleErrors set. In this case, if you have a form that is saving and validation errors are being sent back, the form knows how to handle validation errors and so does not handleError() for this case.

What’s the use case that this is breaking? Did you want to both show validation errors and handle the error in some further way?

Well, we set the following property so that handleError will always fire:
isc.RPCRequest.addClassProperties({
willHandleError: true
});

And, we call isc.warn(response.data) inside of handleErrorr(). The idea is that we show the user a warning dialog in addition to the field level validation. We’ve found that, especially with grids, users like seeing the warning dialog in addition to the field level validation on the grid. However, we now aren’t able to show the warn dialog in handleError with 7.0beta because of the call to addError. So, is there something that has changed or something we are missing?

Hi there, have you been able to recreate this issue where handleError() does not fire client-side when it should if calling addError() server-side?

I don’t think that setting (willHandleError on rpcRequest) would have any effect. It’s not a class property.

There’s no obvious source of a behavior change for grid validation errors. However, the intended behavior for both a grid and form is that validation errors are handled by the component itself (because the component understands this type of error and treats it as normal).

Both the grid and form give you a way to display errors differently or display additional errors (grid.editFailed or form.showErrors()) - will those work?

I’m wondering if I haven’t explained myself very well on this problem?

Server-side, we have logic like this in the event of an error:

dsResponse.setFailure();


//** if the following logic is executed so that dsResponse.addError() is
//called, then handleError() is not getting called client-side
if (e.getMessage() != null && (e.getMessage().equals("exception.update.sectorgroup.name") ){
     dsResponse.addError("name", exceptionText);

}


dsResponse.setData(exceptionText);

Then, we have logic like this to display an isc.warn message client side as follows:

		handleError : function (response, request) {

			
			if(response.status<0 ){
				if(response.data!=null){
					isc.warn(response.data);
					return true;
				}
				
			} 

		}

This has been working just fine for us for a long time. Probably since V5.7.1, handleError fires client-side whether we call dsResponse.addError() server-side or not. Now, with 7.0 Beta, it no longer fires if dsReponse.addError() is called. So, handleError does not fire (again, only if dsResponse.addError() is called server-side) and thus isc.warn is never called.

We don’t want to change this behavior. We want to display the grid error to the user (in the example above, associated with the “name” field) and that is working fine. We just want to add the additional call to isc.warn() like we’ve always had.

So, are you saying you are not able to recreate this issue? Could I send you WAR file showing this behavior off-list so you can see the problem first-hand? Or, have you changed your APIs? I’d prefer not to have to change our logic if this is in fact a bug in 7.0 beta this is fixable.

Hi, just curious if you were able to track down this problem? Just trying to make sure this is resolved before 7.0 final is released.

Hi senordhuff,

We’ve been pointing out that the current behavior appears correct. dsResponse.addError() switches the error status to validation error, and a validation error is a type of error that’s understood by grids and forms and shouldn’t be punted to general error handling code.

However both grids and forms have the ability to let you override how the validation errors are handled:

Both the grid and form give you a way to display errors differently or display additional errors (grid.editFailed or form.showErrors()) - will those work?

Won’t this work for you? It makes much more sense that this specialized error handling is local to the component, and we regard the previous behavior as relying on a now-fixed bug.

Thank you for clarifying that you believe this behavior was related to a bug that has now been fixed on your part. I’ve added an editFailed implementation to reflect this change.