Skip to content

Commit de4665d

Browse files
committed
Adding JSON to underlying error when present
1 parent a46ab67 commit de4665d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog Cobalt
22

3+
## v5.9.5 (30-06-2019)
4+
- Adding json to underlying error when present
5+
36
## v5.9.4 (20-06-2019)
47
- Adding underlying error instead of unknown error
58

Cobalt.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Cobalt"
3-
s.version = "5.9.4"
3+
s.version = "5.9.5"
44
s.author = { "Bas van Kuijck" => "[email protected]" }
55
s.license = { :type => "MIT", :file => "LICENSE" }
66
s.homepage = "http://www.e-sites.nl"

Sources/Core/Base/Error.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ public class Error: Swift.Error {
5353
return Error(code: 301, message: message)
5454
}
5555

56-
public static func underlying(_ error: Swift.Error) -> Error {
56+
public static func underlying(_ error: Swift.Error, json: JSON? = nil) -> Error {
5757
let apiError = Error(code: 601)
5858
apiError.underlyingError = error
59+
60+
if json != nil {
61+
apiError.json = json
62+
}
63+
5964
return apiError
6065
}
6166

@@ -85,6 +90,9 @@ public class Error: Swift.Error {
8590
default:
8691
break
8792
}
93+
94+
_clone(from: Error.underlying(error, json: json))
95+
return
8896
}
8997

9098
_clone(from: Error.underlying(error))

0 commit comments

Comments
 (0)