APIErrorMiddleware icon indicating copy to clipboard operation
APIErrorMiddleware copied to clipboard

error initializing

Open danipralea opened this issue 6 years ago • 2 comments

Hello. first of all, I think docs are outdated, cause APIErrorMiddleware requires an environment variable. I tried to add the middleware:

let auth = router.grouped("auth").group(APIErrorMiddleware(environment: Environment.development))

but it fails with error Type of expression is ambiguous without more context How can I fix this?

Thanks in advance, Dan.

danipralea avatar Aug 05 '19 08:08 danipralea

I'm having the same issue.

tonyarnold avatar Sep 06 '19 06:09 tonyarnold

I got mine working by registering the service first in my app's configure function:

services.register(APIErrorMiddleware.self)

tonyarnold avatar Nov 11 '19 23:11 tonyarnold