-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Handle HTTP errors in DevSupportManager. #4880
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "type": "none", | ||
| "comment": "Handle HTTP connect exceptions in DevSupportManager", | ||
| "packageName": "react-native-windows", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "none", | ||
| "date": "2020-05-12T21:18:36.538Z" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,12 @@ string DevSupportManager::GetJavaScriptFromServer( | |
| Url url(bundleUrl); | ||
| auto const resolveResult = m_resolver.resolve(url.host, url.port); | ||
| tcp::socket socket{m_context}; | ||
| connect(socket, resolveResult); | ||
| boost::system::error_code ec; | ||
| connect(socket, resolveResult, ec); | ||
| if (ec) { | ||
| m_exceptionCaught = true; | ||
| return R"({"error:")"s + ec.message() + R"("})"s; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's strange to return string as error. Why not just have m_errorString? Or some other error pattern?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree. This pattern is similar to an HRESULT or an HTTP code. There is always a return value, but it can be an error type.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See |
||
| } | ||
|
|
||
| request<string_body> request{verb::get, url.Target(), 11}; | ||
| request.set(field::host, url.host); | ||
|
|
@@ -119,7 +124,12 @@ task<void> DevSupportManager::LaunchDevToolsAsync(const string &debugHost, const | |
| Url url(DevServerHelper::get_LaunchDevToolsCommandUrl(debugHost)); | ||
| auto const resolveResult = m_resolver.resolve(url.host, url.port); | ||
| tcp::socket socket{m_context}; | ||
| connect(socket, resolveResult); | ||
| boost::system::error_code ec; | ||
| connect(socket, resolveResult, ec); | ||
| if (ec) { | ||
| m_exceptionCaught = true; | ||
| return; | ||
| } | ||
|
|
||
| request<string_body> request{verb::get, url.Target(), 11}; | ||
| request.set(field::host, url.host); | ||
|
|
||
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.
FYI,
nonemeans Beachball won't publish a build for this or include it in its changelog. This should beprerelease.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.
I was on the fence on this one.
When this change is backported to
0.60-stable, I do plan to generate a new version.for the master branch, didn't think it was worth it.
What criteria would you suggest?
Any change we want reflected on any branch as a new package version should be prerelease?
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.
Basically the only time we want to use “none” is when the change doesn’t impact the package (e.g. changing CI). We switched the master branch to a nightly build to reduce version spam, so you shouldn’t need to worry about this making a new build. Having the commit in a change log is nice though, and we would probably want to publish this if it was the only thing committed that day.