function findSecurityException(exception) {
  let currentException = exception;
  while (currentException != null) {
    if (currentException.fullName === ACCESS_CONTROL_EXCEPTION) {
      return getSecurityException(currentException);
    }
    currentException = currentException.cause;
  }
  return exception;
}
Check the security exception in the exception tree.
@param exception - json object that describes an exception
@returns {Object} add default security message to exception object if security exception is found