Skip to content

Commit 8e9630d

Browse files
committed
add guard
1 parent e2675fa commit 8e9630d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Sources/ParseSwift/Types/ParseError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct ParseError: ParseType, Decodable, Swift.Error {
1515
public let code: Code
1616
public let message: String
1717
public var intCode: Int?
18-
public init(code: Code, message: String) {
18+
init(code: Code, message: String) {
1919
self.code = code
2020
self.message = message
2121
self.intCode = code.rawValue

Tests/ParseSwiftTests/ParseCloudTests.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
358358

359359
func testCustomError() {
360360

361-
let encoded: Data = "{\"error\":\"Error: Custom Error\",\"code\":2000}".data(using: .utf8)!
361+
guard let encoded: Data = "{\"error\":\"Error: Custom Error\",\"code\":2000}".data(using: .utf8) else {
362+
XCTFail("Could not unwrap encoded data")
363+
return
364+
}
362365

363366
MockURLProtocol.mockRequests { _ in
364367
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)

0 commit comments

Comments
 (0)