Skip to content

Commit 46f35cb

Browse files
committed
Additional init for HTTPError
1 parent 3214185 commit 46f35cb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/Hummingbird/Error/HTTPError.swift

+11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ public struct HTTPError: Error, HTTPResponseError, Sendable {
5454
self.body = message
5555
}
5656

57+
/// Initialize HTTPError
58+
/// - Parameters:
59+
/// - status: HTTP status
60+
/// - headers: Headers to include in error
61+
/// - message: Optional associated message
62+
public init(_ status: HTTPResponse.Status, headers: HTTPFields, message: String? = nil) {
63+
self.status = status
64+
self._headers = headers
65+
self.body = message
66+
}
67+
5768
fileprivate struct CodableFormat: Encodable {
5869
struct ErrorFormat: Encodable {
5970
let message: String

0 commit comments

Comments
 (0)