@Override public void handleRequest(Exchange exchange) { try { super.handleRequest(exchange); } catch (Exception e) { LOG.error("Exception while handling a request on the /bs resource", e); exchange.sendResponse(new Response(ResponseCode.INTERNAL_SERVER_ERROR)); } }
@Override public void handleRequest(Exchange exchange) { try { super.handleRequest(exchange); } catch (Exception e) { LOG.error("Exception while handling a request on the /rd resource", e); // unexpected error, we should sent something like a INTERNAL_SERVER_ERROR. // but it would not be LWM2M compliant. so BAD_REQUEST for now... exchange.sendResponse(new Response(ResponseCode.BAD_REQUEST)); } }
@Override public void handleRequest(Exchange exchange) { try { super.handleRequest(exchange); } catch (InvalidRequestException e) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("InvalidRequestException while handling request(%s) on the %s resource", exchange.getRequest(), getURI()), e); } Response response = new Response(ResponseCode.BAD_REQUEST); response.setPayload(e.getMessage()); exchange.sendResponse(response); } catch (Exception e) { LOG.error(String.format("Exception while handling request(%s) on the %s resource", exchange.getRequest(), getURI()), e); exchange.sendResponse(new Response(ResponseCode.INTERNAL_SERVER_ERROR)); } }
@Override public void handleRequest(Exchange exchange) { try { super.handleRequest(exchange); } catch (InvalidRequestException e) { LOG.debug("InvalidRequestException while handling request({}) on the /rd resource", exchange.getRequest(), e); Response response = new Response(ResponseCode.BAD_REQUEST); response.setPayload(e.getMessage()); exchange.sendResponse(response); } catch (RuntimeException e) { LOG.error("Exception while handling request({}) on the /rd resource", exchange.getRequest(), e); exchange.sendResponse(new Response(ResponseCode.INTERNAL_SERVER_ERROR)); } }