Example usage for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR

List of usage examples for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR.

Prototype

HttpStatus INTERNAL_SERVER_ERROR

To view the source code for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR.

Click Source Link

Document

500 Internal Server Error .

Usage

From source file:com.hp.autonomy.frontend.find.hod.search.HodDocumentsController.java

@Override
protected <T> T throwException(final String message) throws HodErrorException {
    throw new HodErrorException(new HodError.Builder().setMessage(message).build(),
            HttpStatus.INTERNAL_SERVER_ERROR.value());
}

From source file:alfio.controller.api.SpecialPriceApiController.java

@ExceptionHandler
@ResponseBody/*w w w .  j a  v a 2  s.  c o m*/
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public String handleExceptions(Exception e) {
    if (!IllegalArgumentException.class.isInstance(e)) {
        log.error("Unexpected exception in SpecialPriceApiController", e);
    }
    return e.toString();
}

From source file:com.hp.autonomy.frontend.find.hod.web.HodGlobalExceptionHandler.java

@ExceptionHandler(HodErrorException.class)
@ResponseBody//from   w  ww  .j  a v a 2 s  . c o m
public ResponseEntity<HodErrorResponse> hodErrorHandler(final HodErrorException exception) {
    final HodErrorResponse hodErrorResponse = new HodErrorResponse("HOD Error", exception.getErrorCode());

    log.error("Unhandled HodErrorException with uuid {}", hodErrorResponse.getUuid());
    log.error("Stack trace", exception);

    return new ResponseEntity<>(hodErrorResponse,
            exception.isServerError() ? HttpStatus.INTERNAL_SERVER_ERROR : HttpStatus.BAD_REQUEST);
}

From source file:com.oneops.sensor.ecv.AppHealthCheck.java

@Override
public IHealth getHealth() {
    IHealth health = Health.FAILED_HEALTH;
    try {//ww  w .j a  va  2  s  .  c o  m
        @SuppressWarnings("unused")
        String ciState = coProcessor.getCIstate(DEFAULT_CID);
        health = Health.OK_HEALTH;
    } catch (Throwable e) {
        logger.error("Exception occurred determining health", e);
        health = new Health(HttpStatus.INTERNAL_SERVER_ERROR.value(), Boolean.FALSE, e.getMessage(), getName());
    }
    return health;
}

From source file:com.epam.ta.reportportal.ws.exception.rest.ExceptionHandlingTest.java

@Parameterized.Parameters(name = "{index}:{0},{1},{2}")
public static List<Object[]> getParameters() {
    return Arrays.asList(new Object[][] {
            { new ReportPortalException(EXCEPTION_MESSAGE), ErrorType.UNCLASSIFIED_REPORT_PORTAL_ERROR,
                    HttpStatus.INTERNAL_SERVER_ERROR, EXCEPTION_MESSAGE },
            { new RuntimeException(EXCEPTION_MESSAGE), ErrorType.UNCLASSIFIED_ERROR,
                    HttpStatus.INTERNAL_SERVER_ERROR, EXCEPTION_MESSAGE },
            { new HttpMessageNotReadableException(EXCEPTION_MESSAGE), ErrorType.INCORRECT_REQUEST,
                    HttpStatus.BAD_REQUEST, EXCEPTION_MESSAGE },
            { new MissingServletRequestParameterException("test", "test"), ErrorType.INCORRECT_REQUEST,
                    HttpStatus.BAD_REQUEST, "Required test parameter 'test' is not present" } });
}

From source file:com.oneops.cms.ws.ecv.AppHealthCheck.java

@Override
public IHealth getHealth() {
    IHealth health = Health.FAILED_HEALTH;
    try {//ww w. j a v a  2 s  .com
        CmsClazz clazz = mdManager.getClazz(DEFAULT_CID);
        health = Health.OK_HEALTH;
    } catch (Throwable e) {
        logger.error("Exception occurred determining health", e);
        health = new Health(HttpStatus.INTERNAL_SERVER_ERROR.value(), Boolean.FALSE, e.getMessage(), getName());
    }
    return health;
}

From source file:com.ogaclejapan.dotapk.WebApiException.java

public static WebApiException asInternalServerError(String message) {
    return new WebApiException(HttpStatus.INTERNAL_SERVER_ERROR, message);
}

From source file:org.osiam.addons.administration.mail.exception.SendEmailException.java

public SendEmailException(String message, String key) {
    super(message, key, HttpStatus.INTERNAL_SERVER_ERROR.value());
}

From source file:com.ge.predix.acs.commons.web.RestErrorHandlerTest.java

@Test
public void testException() {
    RestErrorHandler errorHandler = new RestErrorHandler();

    HttpServletRequest request = new MockHttpServletRequest();
    HttpServletResponse response = new MockHttpServletResponse();
    Exception e = new Exception("Descriptive Error Message");

    ModelAndView errorResponse = errorHandler.createApiErrorResponse(e, request, response);

    // The default error status code is 500
    Assert.assertEquals(response.getStatus(), HttpStatus.INTERNAL_SERVER_ERROR.value());

    // Not null error response containing an ErrorDetails model
    Assert.assertNotNull(errorResponse);
    Assert.assertNotNull(errorResponse.getModel().get("ErrorDetails"));

    // Default response payload error code and message
    assertRestApiErrorResponse(errorResponse, "FAILED", "Operation Failed");

}

From source file:com.ewerk.prototype.api.GlobalErrorHandler.java

/**
 * Called upon internal error. Cannot be called asynchronously.
 *
 * @param exception The exception that was thrown internally.
 * @return A {@link org.springframework.http.ResponseEntity} with status 500
 * (INTERNAL_SERVER_ERROR) and the exception message
 *//*from w  ww. ja va 2 s  .co m*/
@ExceptionHandler(Exception.class)
public ResponseEntity<String> handleException(@Nonnull Exception exception) {
    LOG.error("Internal server error", exception);
    return new ResponseEntity<>(exception.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}