-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from joselinoneto/develop
Develop
- Loading branch information
Showing
7 changed files
with
131 additions
and
63 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
.swiftpm/xcode/xcshareddata/xcschemes/ToolboxAPIClientTests.xcscheme
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by José Neto on 12/03/2023. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum APIErrors: Error, Equatable { | ||
public static func == (lhs: APIErrors, rhs: APIErrors) -> Bool { | ||
lhs.localizedDescription == rhs.localizedDescription | ||
} | ||
|
||
case notFound | ||
case invalidResponse | ||
case authenticationError | ||
case serverError(error: Codable) | ||
} |
23 changes: 23 additions & 0 deletions
23
Tests/ToolboxAPIClientTests/Network/Story/Errors/Errors.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by José Neto on 12/03/2023. | ||
// | ||
|
||
import Foundation | ||
|
||
struct APIReason: Codable { | ||
let error: Bool | ||
let reason: String | ||
} | ||
|
||
class APIError: Codable { | ||
let errorCode: Int | ||
let reason: APIReason | ||
|
||
init(errorCode: String, reason: APIReason) { | ||
self.errorCode = Int(errorCode) ?? 0 | ||
self.reason = reason | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters