Scalatra wraps IllegalStateException thrown by HttpServletRequest#getParts() inside
SizeConstraintExceededException for convenience of use. If the container for some
reason throws an exception other than IllegalStateException when it detects
a file upload that’s too large (or a request body that’s too large),
or you are getting false positives, you can configure the wrapping by
overriding the isSizeConstraintException method.

For example, Jetty 8.1.3 incorrectly throws ServletException instead of IllegalStateException.
You can configure that to be wrapped inside SizeConstraintExceededExceptions
by including the following snippet in your servlet: