void unhandledException(Exception ex, Request req, Response res) {
        final String query = req.queryString();
        final String uri = req.requestMethod() + " " + (isNotBlank(query) ? req.pathInfo() + "?" + query : req.pathInfo());
        LOG.error(format("Unhandled exception on [%s]: %s", uri, ex.getMessage()), ex);

        res.status(HttpURLConnection.HTTP_INTERNAL_ERROR);
        res.body(GSON.toJson(Map.of("error", ex.getMessage() == null ? "Internal server error" : ex.getMessage())));
    }
@Test
    void shouldSendUnhandledExceptionResponseWithoutMessage() {
        Response response = mock(Response.class);

        new RoutesHelper(mock(SparkController.class)).unhandledException(new NullPointerException(), mock(Request.class), response);

        verify(response).status(500);
        verify(response).body("{\"error\":\"Internal server error\"}");
    }