-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Allow serializing underlying NSError objects, closes #10506 #10507
Conversation
By analyzing the blame information on this pull request, we identified @nicklockwood and @javache to be potential reviewers. |
Reviewed By: bestander Differential Revision: D4051237 fbshipit-source-id: ebe919d336b8e4f5d58ef12186026aac37cbc7f2
It's a little odd but the unit tests for this area of the code are in Examples/UIExplorer/UIExplorerUnitTests/ . It would be great to add one! - just a simple one that ensures this one use case works. |
Thanks for pointing me in the right direction @lacker, added a unit test. Let me know what else is needed. |
@facebook-github-bot shipit |
@lacker has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Explain the **motivation** for making this change. What existing problem does the pull request solve? See facebook/react-native#10506. A native `NSError` with `NSUnderlyingErrorKey` set causes a JSON stringify error from the websocket dispatcher if remote debugging is enabled. **Test plan (required)** I'm not familiar with the react native testing framework. Happy to add a test for this if someone can point me to where this part of the codebase is exercised :) I did some spot checks with nil user dictionaries and nil underlying errors here. The case that this solves is testable using https://github.com/superseriouscompany/react-native-error-repro, specifically: ```objective-c NSError *underlyingError = [NSError errorWithDomain:@"underlyingDomain" code:421 userInfo:nil]; NSError *err = [NSError errorWithDomain:@"domain" code:68 userInfo:@{@"NSUnderlyingError": underlyingError}]; reject(@"foo", @"bar", err); ``` Closes facebook/react-native#10507 Differential Revision: D4080802 Pulled By: lacker fbshipit-source-id: 93a41d9e9a710e406a6ccac214a5617271b4bede
Summary: Explain the **motivation** for making this change. What existing problem does the pull request solve? See facebook#10506. A native `NSError` with `NSUnderlyingErrorKey` set causes a JSON stringify error from the websocket dispatcher if remote debugging is enabled. **Test plan (required)** I'm not familiar with the react native testing framework. Happy to add a test for this if someone can point me to where this part of the codebase is exercised :) I did some spot checks with nil user dictionaries and nil underlying errors here. The case that this solves is testable using https://github.com/superseriouscompany/react-native-error-repro, specifically: ```objective-c NSError *underlyingError = [NSError errorWithDomain:@"underlyingDomain" code:421 userInfo:nil]; NSError *err = [NSError errorWithDomain:@"domain" code:68 userInfo:@{@"NSUnderlyingError": underlyingError}]; reject(@"foo", @"bar", err); ``` Closes facebook#10507 Differential Revision: D4080802 Pulled By: lacker fbshipit-source-id: 93a41d9e9a710e406a6ccac214a5617271b4bede
Explain the motivation for making this change. What existing problem does the pull request solve?
See #10506. A native
NSError
withNSUnderlyingErrorKey
set causes a JSON stringify error from the websocket dispatcher if remote debugging is enabled.Test plan (required)
I'm not familiar with the react native testing framework. Happy to add a test for this if someone can point me to where this part of the codebase is exercised :)
I did some spot checks with nil user dictionaries and nil underlying errors here. The case that this solves is testable using https://github.com/superseriouscompany/react-native-error-repro, specifically: