isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manasingarao Shitole <shit...@prime-research.com>
Subject How to configure the ExceptionRecognizer in Isis + how to return different HTTP status codes
Date Thu, 16 Nov 2017 10:48:29 GMT
Hi all,


We would like to define our own ServiceExceptionRecognizer for following exceptions, ex:

- BadRequestException : map to HTTP 400 with the validation message

- RuntimeException : map to HTTP 500 with the appropriate message.


This will help our clients and wicket viewer as well. Instead of propagating entire stack
trace for the expected recoverable errors.


To do that, here is the exception recognizer


public class ServiceExceptionRecognizer extends ExceptionRecognizerForType {
    public ServiceExceptionRecognizer(){
        super(Category.CLIENT_ERROR, ofTypeIncluding(BadRequestException.class, new String[]{"Only
long comma separated values allowed"}), prefix("Bad Request"));
    }
}

Now the question is how to configure the same, tried setting below property in isis.properties
but it doesn't recognize:
isis.services=com.isis.modules.source.dom.exception.ServiceExceptionRecognizer

Where as Isis document says you cant put "isis.services" along with "isis.appManifest"
isis.appManifest=com.isis.application.manifest.DomainAppAppManifest

If we remove the "isis.appManifest" then application will fail to bootstrap.

Of-course I havn't understood correctly and going somewhere wrong. I dont find any clue in
docs nor there are any examples on that.
Could someone guide us with examples, that will be of great help.

Thank you in anticipation.

Kind regards,
-Mansingh



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message