Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark APIErrorDetail properties as public #115

Merged
merged 2 commits into from Oct 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions LineSDK/LineSDK/General/LineSDKError.swift
Expand Up @@ -62,11 +62,22 @@ public enum LineSDKError: Error {
/// - invalidHTTPStatusAPIError: The received response contains an invalid HTTP status code. Code 2004.
public enum ResponseErrorReason {

/// The error detail of a `ResponseErrorReason`. When an error with `ResponseErrorReason` as its reason occurred,
/// there would be an `APIErrorDetail` as the associated value of that reason. This type explains the HTTP
/// status code and the error messages received from LINE server.
public struct APIErrorDetail {
let code: Int
let error: APIError?
let raw: HTTPURLResponse
let rawString: String?

/// The error code received from server. Usually it is the HTTP status code.
public let code: Int

/// An `APIError` object if the response data can be converted to it. Otherwise, `nil`.
public let error: APIError?

/// The raw response when this `invalidHTTPStatusAPIError` happens.
public let raw: HTTPURLResponse

/// The plain error text converted from the response body data if existing.
public let rawString: String?
}

/// An error occurred in the underlying `URLSession` object. Code 2001.
Expand Down