Compare commits
No commits in common. "9b99d9c1ff08a824c2c6417176f8b97b0557223c" and "d34984d4800146ebe60849875c113bbcd182106a" have entirely different histories.
9b99d9c1ff
...
d34984d480
|
|
@ -4,7 +4,7 @@ enum FeishuError: Error, LocalizedError {
|
|||
case unauthorized
|
||||
case networkError(Error?)
|
||||
case apiError(code: Int, message: String)
|
||||
case decodingError(Error, rawBody: String? = nil)
|
||||
case decodingError(Error)
|
||||
case notConfigured
|
||||
case missingCredentials
|
||||
|
||||
|
|
@ -16,11 +16,8 @@ enum FeishuError: Error, LocalizedError {
|
|||
return "Network error: \(error?.localizedDescription ?? "Unknown")"
|
||||
case .apiError(let code, let message):
|
||||
return "Feishu API error (\(code)): \(message)"
|
||||
case .decodingError(let error, let rawBody):
|
||||
if let rawBody {
|
||||
return "Failed to parse Feishu response: \(rawBody)"
|
||||
}
|
||||
return "Failed to parse Feishu response. Field mappings may be incorrect. (\(error.localizedDescription))"
|
||||
case .decodingError:
|
||||
return "Failed to parse Feishu response. Field mappings may be incorrect."
|
||||
case .notConfigured:
|
||||
return "Feishu table not configured. Open Settings."
|
||||
case .missingCredentials:
|
||||
|
|
|
|||
|
|
@ -78,10 +78,6 @@ final class FeishuService {
|
|||
guard let httpResponse = response as? HTTPURLResponse else {
|
||||
throw FeishuError.networkError(nil)
|
||||
}
|
||||
|
||||
let rawBody = String(data: data, encoding: .utf8) ?? "<binary \(data.count)B>"
|
||||
BuggerLog.debug("fetchPage: HTTP \(httpResponse.statusCode) body=\(String(rawBody.prefix(500)))")
|
||||
|
||||
if httpResponse.statusCode == 401 {
|
||||
throw FeishuError.unauthorized
|
||||
}
|
||||
|
|
@ -90,9 +86,7 @@ final class FeishuService {
|
|||
do {
|
||||
apiResponse = try decoder.decode(FeishuAPIResponse<RecordListData>.self, from: data)
|
||||
} catch {
|
||||
BuggerLog.error("fetchPage: decode FAILED: \(error)")
|
||||
BuggerLog.error("fetchPage: raw body: \(String(rawBody.prefix(1000)))")
|
||||
throw FeishuError.decodingError(error, rawBody: String(rawBody.prefix(200)))
|
||||
throw FeishuError.decodingError(error)
|
||||
}
|
||||
|
||||
guard apiResponse.code == 0, let pageData = apiResponse.data else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue