-
-
Notifications
You must be signed in to change notification settings - Fork 596
feat: Allow custom server connection fail message #2011
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
Conversation
Thanks for opening this pull request! |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## alpha #2011 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 61 61
Lines 6137 6137
Branches 1497 1497
=========================================
Hits 6137 6137
☔ View full report in Codecov by Sentry. |
Internal methods are not considered breaking changes, so we can ignore that fact. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be the correct fix for the bug. The reported bug is that the error message 'XMLHttpRequest failed: "Unable to connect to the Parse API"
"is rather confusing for client users." We do have an existing Parse.Error that has a clear error message The connection to the Parse servers failed.
, which should be thrown, see:
This is a feature not a bug fix. I want to change the message entirely as I don't want people to know I use
|
I see, but building a feature on top of incorrect code could make the bug fix more complicated. If the bug is fixed and the error message of Parse.Error 100 is thrown, then the concept of your feature may need to change significantly. I also think that we may need to think about how we override with custom error messages. The way this is currently designed in this PR seem to require a condition everywhere the error is, but when a Parse.Error is thrown (the bug is fixed), it may make more sense to override the predefined Parse.Error message at it's definition. |
I'm not sure I'm following you. What is missing from this PR? |
I think it makes more sense to fix the bug first, and then think about how to override the message of the Parse.Error 100. Overriding the Parse.Error message may require a different solution than this PR currently implements. |
Basically you want me to throw this by default?
|
Yes, apologies for the confusion, I assumed the error messages were hard coded in Let's assume we wants to allow customizing other error messages as well in the future. So we would end up with a whole lot of string definitions in the Core Manager. That doesn't seem to be an elegant solution. I wonder if this PR can be rewritten in a way so that it's more flexible. For example instead of creating a separate key for each error message, why not let the developer define the error code and the overriding message? Like so:
Then, in the Parse.Error constructor you could simply override the So I'd change:
|
I think that could work. Let me look into it. |
|
Closing in favor of #2014 |
Pull Request
Issue
Allows users to change the default connection failed message. Developers will be able to display more helpful messages. This is a breaking change for developers that use
Parse._ajax
which is unlikely since ajax is used internally.Closes: #1469
Approach
CONNECTION_FAILED_MESSAGE
to CoreManagerParse.Error
inRESTController.ajax
Tasks