Search in sources :

Example 1 with ExceptionInfo

use of org.nzbhydra.ExceptionInfo in project nzbhydra2 by theotherp.

the class NewsWeb method handleNewsException.

@ExceptionHandler(value = { IOException.class })
protected ResponseEntity<ExceptionInfo> handleNewsException(IOException ex, WebRequest request) {
    String error = "An error occurred while getting news: " + ex.getMessage();
    logger.error(error);
    return new ResponseEntity<>(new ExceptionInfo(500, error, ex.getClass().getName(), error, request.getContextPath()), HttpStatus.valueOf(500));
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ExceptionInfo(org.nzbhydra.ExceptionInfo) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler)

Example 2 with ExceptionInfo

use of org.nzbhydra.ExceptionInfo in project nzbhydra2 by theotherp.

the class UpdatesWeb method handleUpdateException.

@ExceptionHandler(value = { UpdateException.class })
protected ResponseEntity<ExceptionInfo> handleUpdateException(UpdateException ex) {
    String error = "An error occurred while updating or getting update infos: " + ex.getMessage();
    logger.error(error);
    return new ResponseEntity<>(new ExceptionInfo(500, error, ex.getClass().getName(), error, SessionStorage.requestUrl.get()), HttpStatus.valueOf(500));
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ExceptionInfo(org.nzbhydra.ExceptionInfo)

Aggregations

ExceptionInfo (org.nzbhydra.ExceptionInfo)2 ResponseEntity (org.springframework.http.ResponseEntity)2 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1