Skip to content

Commit c57ffcc

Browse files
committed
Fix example apps for 1.0
1 parent 4ae3ee0 commit c57ffcc

File tree

7 files changed

+18
-6
lines changed

7 files changed

+18
-6
lines changed

Examples/BugReport/Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import PackageDescription
33

44
let package = Package(
55
name: "BugReport",
6+
platforms: [
7+
.macOS(.v10_14)
8+
],
69
dependencies: [
710
.package(url: "https://github.com/mongodb/mongo-swift-driver", .upToNextMajor(from: "1.0.0-rc0"))
811
],

Examples/Docs/Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import PackageDescription
33

44
let package = Package(
55
name: "DocsExamples",
6+
platforms: [
7+
.macOS(.v10_14)
8+
],
69
dependencies: [
710
.package(url: "https://github.com/mongodb/mongo-swift-driver", .branch("master")),
811
.package(url: "https://github.com/apple/swift-nio", .upToNextMajor(from: "2.0.0"))

Examples/Docs/Sources/AsyncExamples/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private func transactions() throws {
188188
let eventLoop = txnFuture.eventLoop
189189
return txnFuture.flatMapError { error in
190190
guard
191-
let labeledError = error as? LabeledError,
191+
let labeledError = error as? MongoLabeledError,
192192
labeledError.errorLabels?.contains("TransientTransactionError") == true
193193
else {
194194
return eventLoop.makeFailedFuture(error)
@@ -205,7 +205,7 @@ private func transactions() throws {
205205
let eventLoop = commitFuture.eventLoop
206206
return commitFuture.flatMapError { error in
207207
guard
208-
let labeledError = error as? LabeledError,
208+
let labeledError = error as? MongoLabeledError,
209209
labeledError.errorLabels?.contains("UnknownTransactionCommitResult") == true
210210
else {
211211
print("Error during commit...")

Examples/Docs/Sources/SyncExamples/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private func transactions() throws {
119119
} catch {
120120
print("Transaction aborted. Caught exception during transaction.")
121121
guard
122-
let labeledError = error as? LabeledError,
122+
let labeledError = error as? MongoLabeledError,
123123
labeledError.errorLabels?.contains("TransientTransactionError") == true
124124
else {
125125
throw error
@@ -141,7 +141,7 @@ private func transactions() throws {
141141
break
142142
} catch {
143143
guard
144-
let labeledError = error as? LabeledError,
144+
let labeledError = error as? MongoLabeledError,
145145
labeledError.errorLabels?.contains("UnknownTransactionCommitResult") == true
146146
else {
147147
print("Error during commit ...")

Examples/KituraExample/Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import PackageDescription
33

44
let package = Package(
55
name: "KituraExample",
6+
platforms: [
7+
.macOS(.v10_14)
8+
],
69
dependencies: [
710
.package(url: "https://github.com/IBM-Swift/Kitura", .upToNextMajor(from: "2.9.1")),
811
.package(url: "https://github.com/mongodb/mongo-swift-driver", .upToNextMajor(from: "1.0.0")),

Examples/PerfectExample/Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import PackageDescription
33

44
let package = Package(
55
name: "PerfectExample",
6+
platforms: [
7+
.macOS(.v10_14)
8+
],
69
dependencies: [
710
.package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", from: "3.0.0"),
811
.package(url: "https://github.com/mongodb/mongo-swift-driver", .upToNextMajor(from: "1.0.0")),

Examples/VaporExample/Sources/VaporExample/routes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ func routes(_ app: Application) throws {
1212
/// `Kitten` from the collection. `MongoCollection` is safe to share across threads.
1313
let collection = app.mongoClient.db("home").collection("kittens", withType: Kitten.self)
1414

15-
app.get("kittens") { _ -> EventLoopFuture<[Kitten]> in
15+
app.get("kittens") { req -> EventLoopFuture<[Kitten]> in
1616
collection.find().flatMap { cursor in
1717
cursor.toArray()
18-
}
18+
}.hop(to: req.eventLoop)
1919
}
2020
}

0 commit comments

Comments
 (0)