users@jersey.java.net

SV: [Jersey] Started work on improving Jersey's error reporting

From: Morten <mortench2004_at_yahoo.dk>
Date: Tue, 25 May 2010 17:07:43 +0000 (GMT)

Great. I also plead guilty to asserts on injects. Another thing I do is to add a error handler on the service side that attaches the exception trace to the error message + this code on the client side: protected <T> T getRequest(String etagHeader, EntityTag etag, Class<T> clazz, URI uri, String mediaType) throws Exception { WebResource res = jerseyClient.resource(uri); Builder builder = res.accept(mediaType).acceptLanguage(locale); if (etag!=null && etag.getValue()!=null && etag.getValue().length()>0 && etagHeader!=null) builder=builder.header(etagHeader, etagHeaderString(etag)); // Get request result in a safe way so we get the full error description if there are errors. ClientResponse clientResponse = builder.get(ClientResponse.class); if (clazz.equals(ClientResponse.class)) return (T)clientResponse; if (clientResponse.getStatus()<=MAX_NO_ERROR_HTTP_CODE) { return clientResponse.getEntity(clazz); } else { String errStr = getFullErrorString(uri, clientResponse); throw new UniformInterfaceException(errStr, clientResponse, false); } } --- Den tirs 25/5/10 skrev Paul Sandoz <Paul.Sandoz_at_Sun.COM>: > Fra: Paul Sandoz <Paul.Sandoz_at_Sun.COM> > Emne: [Jersey] Started work on improving Jersey's error reporting > Til: "Jersey-Users Mailing List" <users_at_jersey.dev.java.net> > Dato: tirsdag 25. maj 2010 18.44 > Hi, > > I finally got around to working on improving Jersey's error > reporting. After seeing that some developers were using > asserts for checking injected dependencies themselves i > simply could not let this languish any more. > > I have made a first commit that just logs warnings of > un-bound dependencies for injection and class construction > issues. > > Once i sort out contextual error reporting i will unify the > above with errors related to the JAX-RS model and such > errors will result in deployment or a 500 runtime error. As > many errors as possible will be reported to avoid the > developer being trapped in an annoying compile and fix > loop. > > Paul. > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net > For additional commands, e-mail: users-help_at_jersey.dev.java.net > >