Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Aug 20, 2019
1 parent ffe557f commit 395434f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/*.xcodeproj
Package.resolved
DerivedData
.swiftpm

9 changes: 7 additions & 2 deletions Sources/Leaf/LeafProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Vapor
public final class LeafProvider: Provider {
public init() { }

public func register(_ s: inout Services) throws {
public func register(_ s: inout Services) {
s.register(LeafRenderer.self) { c in
return try LeafRenderer(config: c.make(), threadPool: c.make(), eventLoop: c.eventLoop)
}
Expand All @@ -23,7 +23,12 @@ extension LeafRenderer: ViewRenderer {
public func render<E>(_ name: String, _ context: E) -> EventLoopFuture<View>
where E: Encodable
{
let data = try! LeafEncoder().encode(context)
let data: [String: LeafData]
do {
data = try LeafEncoder().encode(context)
} catch {
return self.eventLoop.makeFailedFuture(error)
}
return self.render(path: name, context: data).map { buffer in
return View(data: buffer)
}
Expand Down

0 comments on commit 395434f

Please sign in to comment.