Skip to content

Commit a13f0f6

Browse files
author
sfomuseumbot
committed
improved error reporting
1 parent 682aea7 commit a13f0f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/SwifterProtomaps/SwifterProtomaps.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ public func ServeProtomapsTiles(_ opts: ServeProtomapsOptions) -> ((HttpRequest)
4747

4848
// https://developer.apple.com/documentation/foundation/filehandle
4949

50-
guard let file = FileHandle(forReadingAtPath: path) else {
51-
opts.Logger?.error("Not found: \(path)")
50+
var file: FileHandle
51+
52+
do {
53+
file = try FileHandle(forReadingFrom: uri)
54+
} catch {
55+
opts.Logger?.error("Failed to open path (\(path)) for reading \(error)")
5256
return .raw(404, "Not found", rsp_headers, {_ in })
5357
}
5458

0 commit comments

Comments
 (0)