AnsweredAssumed Answered

Throwing exceptions in a logic hook in Sugar 7

Question asked by Jason Eggers on Mar 17, 2014
Latest reply on Jun 13, 2014 by Jason Eggers
In a before_save logic hook I'm checking for certain conditions. When caught I'd like to do something like:
throw new SugarApiExceptionInvalidParameter('My customized error message here');
However, this causes some weird error in addition to the Invalid Param error that does a half redirect to the login page. (Body only. Not the header).

1st error displayed: "There was an error while connecting to the server. Please try again."
2nd error displayed: "Request error and/or invalid parameter..." (can't read the rest fast enough).

As a workaround I'm simply resetting the field value to the original value without giving the user any indication that it is being reset.

Is there another way to accomplish this and abort a save?