Skip to content
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

Fix error and create error handling for snapshot taking. #5520

Merged
merged 30 commits into from
Mar 28, 2023

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Mar 24, 2023

Fixes #5510

Screen.Recording.2023-03-24.at.3.05.25.PM.mov
@polina-c polina-c requested review from bkonyi and a team as code owners March 24, 2023 22:15
Future<void> _takeSnapshot(BuildContext context) async {
try {
await controller.takeSnapshot();
} catch (e, trace) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} catch (e, trace) {
} catch (e, trace) {
_log.shout(e,e,trace);

It would be good to log this in case the user wants to send us some logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error dialog box will give all the details, copyable to clipboard.

Copy link
Member

Choose a reason for hiding this comment

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

we also want to log this to our analytics though. @CoderDake will _log.shout propagate the error to our analytics?

packages/devtools_app/lib/src/shared/new_issue.dart Outdated Show resolved Hide resolved
@@ -34,6 +39,51 @@ final dialogTextFieldDecoration = InputDecoration(
),
);

/// A dialog, that reports unexpected error and allows to copy details and create issue.
class UnexpectedErrorDialog extends StatelessWidget {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a screenshot of the updated dialog to the PR comments? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-03-28 at 10 32 47 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is scrollable when text is too large.

Comment on lines 62 to 65
if (issueDetails == null)
throw StateError(
'Issue details cannot be null, because length limit is reached.',
);
Copy link
Member

Choose a reason for hiding this comment

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

this error is a bit confusing 🤔 instead of throwing an error, lets add the check for issueDetails == null to the if check on line 60.

if (issueDetails == null || lengthToCut <=0) return fullUri;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cut additionalInfo instead

.toString(),
url: newDevToolsGitHubIssueUriLengthSafe(
additionalInfo: issueDetails,
environment: issueLinkDetails(),
Copy link
Member

Choose a reason for hiding this comment

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

we don't need to pass this in as a parameter. The issueLinkDetails can be looked up directly from inside the newDevToolsGitHubIssueUriLengthSafe method

Copy link
Contributor Author

@polina-c polina-c Mar 28, 2023

Choose a reason for hiding this comment

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

It is not very important which method makes this call.
I moved the call for testability: I do not want the test to worry about mocking the environment.

@polina-c polina-c merged commit cd6f9e3 into flutter:master Mar 28, 2023
@polina-c polina-c deleted the exception-5510 branch March 28, 2023 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants