public ErrorResponse buildErrorResponse(RestLiServiceException result)
  {
    // In some cases, people use 3XX to signal client a redirection. This falls into the category of blurred boundary
    // whether this should be an error or not, in order to not disrupt change the behavior of existing code
    // Thus excluding logging errors for 3XX
    if (result.getStatus() != null && result.getStatus().getCode() < HttpStatus.S_300_MULTIPLE_CHOICES.getCode())
    {
      // Invalid to send an error response with success status codes. This should be converted to 500 errors.
      // Logging an error message now to detect and fix current use cases before we start converting to 500.
      LOGGER.error("Incorrect use of success status code with error response", result);
    }

    if (result.getStatus() == HttpStatus.S_204_NO_CONTENT)
    {
      // HTTP Spec requires the response body to be empty for HTTP status 204.
      return new ErrorResponse();
    }

    return buildErrorResponse(result, result.hasOverridingErrorResponseFormat() ? result.getOverridingFormat() : _errorResponseFormat);
  }
@Test
  public void testNullStatus()
  {
    RestLiServiceException exception = new RestLiServiceException((HttpStatus) null);
    ErrorResponseBuilder builder = new ErrorResponseBuilder(ErrorResponseFormat.FULL);

    ErrorResponse errorResponse = builder.buildErrorResponse(exception);
    Assert.assertFalse(errorResponse.hasStatus());
  }