-
-
Notifications
You must be signed in to change notification settings - Fork 70
Parse Swift can't decode custom ParseCloud errors #164
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
Comments
@dblythy thanks for your PR! Here’s a response I gave to a similar proposal? #106 (comment) From your addition, does this mean the other SDKs currently allow users to create their own errors and mask them as Parse errors? I could be wrong here, but I would think errors would come from a set list of known Parse errors. If a user generates an error, maybe it can fall under “unknownError” or add a new error code on the server specific to user errors? Not sure what’s the best approach, but definitely open to hear you and the servers team thoughts. My fear is allowing developers to mask their errors as parse errors and then people submit issues to Parse repos claiming they are Parse errors when they are not |
My reasoning of using unknownError is because of how Flo documented ParseError before I took over it: Parse-Swift/Sources/ParseSwift/Types/ParseError.swift Lines 35 to 37 in 603486a
It seems believed all SDK errors, technically custom SDK errors should fall under this error. So I can see other errors going here as well |
The main problem is that if you use a custom error, (which is already supported in Parse Server as well as every other SDK) Parse Swift can't decode it. Such as:
Call function:
|
If I understand the discussion you linked it’s proposing to restrict custom errors to a specific range? parse-community/docs#943 That seems reasonable I guess and prevent some of my concern above |
The discussion linked is more to highlight that throwing specific custom errors from Cloud Code or third party modules is a common use case. The main use for me is to change the behaviour of the app based on the custom error code response from the Parse Server. |
FYI to anyone hoping to use this, you can use ParseError.otherCode if you are throwing custom Parse Errors from Parse Cloud |
Throwing a custom error code from a Parse Cloud function results in:
Failing case:
Proposed solution:
Add
.other
enum to error, andintCode
property to Parse.ErrorThe text was updated successfully, but these errors were encountered: