diff --git a/README.md b/README.md index a388d18..a7c55cf 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ public func routes(_ router: Router) throws { return try s3.create(bucket: "api-created-bucket", region: .euCentral1, on: req).map(to: String.self) { return ":)" }.catchMap({ (error) -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":(" @@ -195,7 +195,7 @@ public func routes(_ router: Router) throws { return try s3.delete(bucket: "api-created-bucket", region: .euCentral1, on: req).map(to: String.self) { return ":)" }.catchMap({ (error) -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":(" @@ -207,7 +207,7 @@ public func routes(_ router: Router) throws { router.get("files") { req -> Future in let s3 = try req.makeS3Client() return try s3.list(bucket: "booststore", region: .usEast1, headers: [:], on: req).catchMap({ (error) -> (BucketResults) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { print(error.message) } throw error @@ -242,7 +242,7 @@ public func routes(_ router: Router) throws { let json = try JSONEncoder().encode(infoResponse) return String(data: json, encoding: .utf8) ?? "Unknown content!" }.catchMap({ error -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":(" diff --git a/Sources/S3/Extensions/Error+S3.swift b/Sources/S3/Extensions/Error+S3.swift index 76227c4..d1a14c9 100644 --- a/Sources/S3/Extensions/Error+S3.swift +++ b/Sources/S3/Extensions/Error+S3.swift @@ -20,7 +20,7 @@ extension Error { } /// Return S3 ErrorMessage if possible - public func s3ErroMessage() -> ErrorMessage? { + public func s3ErrorMessage() -> ErrorMessage? { guard let error = self as? S3.Error else { return nil } @@ -33,7 +33,7 @@ extension Error { } /// Return S3 error status code if possible - public func s3ErroCode() -> HTTPResponseStatus? { + public func s3ErrorCode() -> HTTPResponseStatus? { guard let error = self as? S3.Error else { return nil } diff --git a/Sources/S3DemoApp/S3DemoApp.swift b/Sources/S3DemoApp/S3DemoApp.swift index ad8c18b..0d78d6c 100644 --- a/Sources/S3DemoApp/S3DemoApp.swift +++ b/Sources/S3DemoApp/S3DemoApp.swift @@ -17,7 +17,7 @@ public func routes(_ router: Router) throws { return try s3.create(bucket: "api-created-bucket", region: .euCentral1, on: req).map(to: String.self) { return ":)" }.catchMap({ (error) -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":(" @@ -31,7 +31,7 @@ public func routes(_ router: Router) throws { return try s3.delete(bucket: "api-created-bucket", region: .euCentral1, on: req).map(to: String.self) { return ":)" }.catchMap({ (error) -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":(" @@ -43,7 +43,7 @@ public func routes(_ router: Router) throws { router.get("files") { req -> Future in let s3 = try req.makeS3Client() return try s3.list(bucket: "booststore", region: .usEast1, headers: [:], on: req).catchMap({ (error) -> (BucketResults) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { print(error.message) } throw error @@ -93,7 +93,7 @@ public func routes(_ router: Router) throws { let json = try JSONEncoder().encode(infoResponse) return String(data: json, encoding: .utf8) ?? "Unknown content!" }.catchMap({ error -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":(" @@ -102,7 +102,7 @@ public func routes(_ router: Router) throws { } } }.catchMap({ error -> (String) in - if let error = error.s3ErroMessage() { + if let error = error.s3ErrorMessage() { return error.message } return ":("