Skip to content

Commit

Permalink
Set environment based on worker and add ModelNotFound error specializ…
Browse files Browse the repository at this point in the history
…ation to instance returned By APIErrorMiddleware.makeService(for:)
  • Loading branch information
calebkleveter committed May 25, 2018
1 parent 023c5a7 commit 3e27b44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/APIErrorMiddleware/APIErrorMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class APIErrorMiddleware: Middleware, Service, ServiceType {

/// Creates a service instance. Used by a `ServiceFactory`.
public static func makeService(for worker: Container) throws -> APIErrorMiddleware {
return APIErrorMiddleware()
return APIErrorMiddleware(environment: worker.environment, specializations: [ModelNotFound()])
}

/// Catch all errors thrown by the route handler or
Expand Down

0 comments on commit 3e27b44

Please sign in to comment.