code: public static ObjectResult newErrorResult(String errMsg, String objID) {
          ObjectResult result = new ObjectResult();
          result.setStatus(Status.ERROR);
          result.setErrorMessage(errMsg);
          if (!Utils.isEmpty(objID)) {
              result.setObjectID(objID);
          }
          return result;
      }
docs: Create an ObjectResult with a status of ERROR and the given error message and
  optional object ID.
  
  @param errMsg    Error message.
  @param objID     Optional object ID.
  @return          {@link ObjectResult} with an error status and message.