Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Gayathri Sairamkrishnan committed Dec 19, 2024
1 parent f0a8282 commit d8073b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/OpenAPIRuntime/Errors/RuntimeError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import protocol Foundation.LocalizedError
import struct Foundation.Data
import HTTPTypes

/// Error thrown by generated code.
internal enum RuntimeError: Error, CustomStringConvertible, LocalizedError, PrettyStringConvertible {

Expand Down Expand Up @@ -147,7 +148,7 @@ extension RuntimeError: HTTPResponseConvertible {
/// HTTP Status code corresponding to each error case
public var httpStatus: HTTPTypes.HTTPResponse.Status {
switch self {
case .invalidServerURL, .invalidServerVariableValue: .notFound
case .invalidServerURL, .invalidServerVariableValue, .pathUnset: .notFound
case .invalidExpectedContentType, .unexpectedContentTypeHeader: .unsupportedMediaType
case .missingCoderForCustomContentType: .unprocessableContent
case .unexpectedAcceptHeader: .notAcceptable
Expand All @@ -157,7 +158,6 @@ extension RuntimeError: HTTPResponseConvertible {
.missingRequiredMultipartFormDataContentType, .missingRequiredQueryParameter, .missingRequiredPathParameter,
.missingRequiredRequestBody, .unsupportedParameterStyle:
.badRequest
case .pathUnset: .notFound
case .handlerFailed, .middlewareFailed, .missingRequiredResponseBody, .transportFailed,
.unexpectedResponseStatus, .unexpectedResponseBody:
.internalServerError
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIRuntimeTests/Errors/Test_RuntimeError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct MockRuntimeErrorHandler: Sendable {
}

final class Test_RuntimeError: XCTestCase {
func testRuntimeError_withUnderlyingErrorNotConfirming_returns500() async throws {
func testRuntimeError_withUnderlyingErrorNotConforming_returns500() async throws {
let server = UniversalServer(
handler: MockRuntimeErrorHandler(failWithError: RuntimeError.transportFailed(TestError())),
middlewares: [ErrorHandlingMiddleware()]
Expand All @@ -49,7 +49,7 @@ final class Test_RuntimeError: XCTestCase {
XCTAssertEqual(response.0.status, .internalServerError)
}

func testRuntimeError_withUnderlyingErrorConfirming_returnsCorrectStatusCode() async throws {
func testRuntimeError_withUnderlyingErrorConforming_returnsCorrectStatusCode() async throws {
let server = UniversalServer(
handler: MockRuntimeErrorHandler(failWithError: TestErrorConvertible.testError("Test Error")),
middlewares: [ErrorHandlingMiddleware()]
Expand Down

0 comments on commit d8073b4

Please sign in to comment.