Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit b6ed121

Browse files
Merge pull request #53 from nodes-vapor/feature/beta-2
Feature/beta 2
2 parents 6b99ec6 + 4e03521 commit b6ed121

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@ reporter.report(
7272
)
7373
```
7474

75-
Reporting an error returns a discardable future. Just map/flatMap the result if you would like to do more work after the report has been sent.
76-
77-
```swift
78-
return reporter.error(yourError, on: req).flatMap {
79-
...
80-
}
81-
```
82-
8375
#### Users
8476
Conforming your `Authenticatable` model to `BugsnagReportableUser` allows you to easily pair the data to a report. The protocol requires your model to have an `id` field that is `CustomStringConvertible`.
8577

@@ -121,4 +113,4 @@ The package owner for this project is [Siemen](https://github.com/siemensikkema)
121113

122114
## 📄 License
123115

124-
This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
116+
This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

Sources/Bugsnag/BugsnagMiddleware.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ extension BugsnagMiddleware: Middleware {
1010
return Future.flatMap(on: req) {
1111
try next.respond(to: req)
1212
}.catchFlatMap { error in
13-
self.reporter.report(error, on: req)
14-
throw error
13+
self.reporter
14+
.report(error, on: req)
15+
.map { throw error }
1516
}
1617
}
1718
}

Sources/Bugsnag/BugsnagProvider.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public final class BugsnagProvider: Provider {
88
}
99

1010
public func register(_ services: inout Services) throws {
11+
services.register(BugsnagMiddleware.self)
1112
services.register(BugsnagReporter(config: config), as: ErrorReporter.self)
1213
services.register { container in
1314
return BreadcrumbContainer()

Sources/Bugsnag/ErrorReporter.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Vapor
22

33
public protocol ErrorReporter {
4-
@discardableResult
54
func report(
65
_ error: Error,
76
severity: Severity,
@@ -16,7 +15,6 @@ public protocol ErrorReporter {
1615
}
1716

1817
extension ErrorReporter {
19-
@discardableResult
2018
func report(
2119
_ error: Error,
2220
severity: Severity = .error,
@@ -41,7 +39,6 @@ extension ErrorReporter {
4139
)
4240
}
4341

44-
@discardableResult
4542
func report<U: BugsnagReportableUser>(
4643
_ error: Error,
4744
severity: Severity = .error,
@@ -68,4 +65,3 @@ extension ErrorReporter {
6865
}
6966
}
7067
}
71-

0 commit comments

Comments
 (0)