Skip to content

Commit 8757be9

Browse files
committed
Give unreachable scenario a distinct error instead of overloading 500s
1 parent 458a472 commit 8757be9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Sources/App/Commands/Ingestion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ enum Ingestion {
291291
// https://github.com/swiftlang/swift/issues/76169
292292
assert(false, "Unexpected error type: \(type(of: error))")
293293
// We need to throw _something_ here (we should never hit this codepath though)
294-
throw Github.Error.requestFailed(.internalServerError)
294+
throw Github.Error.unexpectedError(error)
295295
// We could theoretically avoid this whole second catch and just do
296296
// error as! GithubError
297297
// but let's play it safe and not risk a server crash, unlikely as it may be.

Sources/App/Core/Github.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ enum Github {
2828
case invalidURL(String)
2929
case postRequestFailed(_ url: String, Swift.Error)
3030
case requestFailed(HTTPStatus)
31+
case unexpectedError(Swift.Error)
3132
}
3233

3334
static var decoder: JSONDecoder {

0 commit comments

Comments
 (0)