Rest errors

* Adds `ClassCoercionException`, thrown by methods in `TypeCoercions`. DefaultExceptionMapper in rest project catches these rather than all ClassCastExceptions.
* Extends and improves the `ApiError` class with optional 'details' field.
* Throwables can be turned into ApiErrors with message the exception message (or class name if message is null) and details the exception stack trace.