Preserve stack trace for ApiController exceptions (fixes #1313).