Skip to content

NetworkError: implement optional raw `Data`

Compare
Choose a tag to compare
@MihaelIsaev MihaelIsaev released this 05 Nov 21:04
· 68 commits to master since this release

So now you're also able to parse error response data if needed

.onError { error in
    switch error.code {
    case .notFound: print("It's not found :(")
    default:
        print("Another error happened: " + error.description)
        if let raw = error.raw, let rawResponse = String(data: raw, encoding: .utf8) {
            print("Raw response: " + rawResponse)
        }
    }
}