Skip to content

Add __type checking #710

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

Merged
merged 7 commits into from
Mar 2, 2016
Merged

Conversation

sdf611097
Copy link
Contributor

Add __type checking
Avoid object saved with wrong format from REST API.

@gfosco
Copy link
Contributor

gfosco commented Feb 29, 2016

Not sure if we should provide the json-string version of the object in the error messages... I'm thinking we should not. Do you have an opinion on this @drew-gross ?

@drew-gross
Copy link
Contributor

Yeah my suggestion would be to not return that as an error. Too much potential for information to leak to people who shouldn't be able to see it.

@sdf611097
Copy link
Contributor Author

How can I modify these messages, or any variables I can get from JavascriptSDK? The messages are similar as current Parse API server response.

@facebook-github-bot
Copy link

@sdf611097 updated the pull request.

@sdf611097
Copy link
Contributor Author

Hi @gfosco @drew-gross ,
I modify the error message. Is that what you want?

}
break;
default :
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, 'invalid type: ' + obj.__type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as each case returns, you could just add after the switch throw new Parse.Error(Parse.Error.INCORRECT_TYPE, 'invalid type: ' + obj.__type);

@drew-gross
Copy link
Contributor

@flovilmart has a good suggestion, but I'm going to merge this anyway. If you want to updated in a new PR, that would make the code a little cleaner :)

drew-gross added a commit that referenced this pull request Mar 2, 2016
@drew-gross drew-gross merged commit 4b7447e into parse-community:master Mar 2, 2016
@flovilmart flovilmart mentioned this pull request Mar 3, 2016
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

Successfully merging this pull request may close these issues.

5 participants