8000 Context handling error response as unknown incorrectly. · Issue #32 · aronbalog/Vox · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Context handling error response as unknown incorrectly. #32

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

Open
markturnip opened this issue Mar 3, 2020 · 1 comment
Open

Context handling error response as unknown incorrectly. #32

markturnip opened this issue Mar 3, 2020 · 1 comment

Comments

@markturnip
Copy link

My response payload contains the following error:

{
    "errors": {
        "detail": {
            "auth": [
                "invalid password"
            ]
        }
    }
}

However Vox will always respond with JSONAPIError.serialization due to not casting the error array correctly:
https://github.com/aronbalog/Vox/blob/master/Vox/Core/Class/Context.swift#L42

(lldb) po dictionary["errors"] as? NSArray
nil

(lldb) po dictionary["errors"] as? NSMutableArray
nil

(lldb) po type(of: dictionary["errors"])
Swift.Optional<Any>

(lldb) po dictionary["errors"]
▿ Optional<Any>
  ▿ some : 1 element
    ▿ 0 : 2 elements
      - key : detail
      ▿ value : 1 element
        ▿ 0 : 2 elements
          - key : auth
          ▿ value : 1 element
            - 0 : invalid email or password
@markturnip
Copy link
Author

ah this may well be due to the fact the response is a dictionary rather than a array!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0