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

🐛 Bug Report: (Apple SDK) "type" is not present in AppWriteError #41

Closed
2 tasks done
IvanBogdantsev opened this issue Sep 10, 2023 · 3 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@IvanBogdantsev
Copy link

👟 Reproduction steps

Hello,

I don't get how to localize errors returned from AppWrite. The only things present in AppwriteError instance are code and message. The "type" is always nil.

So, if I am not mistaken the only way to provide users with accurate error description is to localize errors based on the "message" property..?

If so, then we will get something like

//...
switch error.message {
case "Invalid email : please provide valid email": return "something localized"
case ...//
}

If so, this is not okay. I still hope though that this could be done easily and I did not get how to do that because I am new to AppWrite

P.S. this question was raised in AppWrite Discord and I got confirmation from Steven (@drake) that there is indeed problem is extracting "type"

👍 Expected behavior

"type" not nil

👎 Actual Behavior

"type" is nil

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@IvanBogdantsev IvanBogdantsev added the bug Something isn't working label Sep 10, 2023
@stnguyen90
Copy link
Contributor

I think it's only missing here:

throw AppwriteError(

@IvanBogdantsev
Copy link
Author

Hello,
So, have you managed to resolve the issue?

@stnguyen90
Copy link
Contributor

@IvanBogdantsev version 4.0.1 of the Apple SDK should be setting the type now:

throw AppwriteError(
message: message,
code: Int(response.status.code),
type: type

Are you able to upgrade and check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants