Skip to content

Handle error.#838

Draft
polina-c wants to merge 6 commits intoflutter:mainfrom
polina-c:error
Draft

Handle error.#838
polina-c wants to merge 6 commits intoflutter:mainfrom
polina-c:error

Conversation

@polina-c
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request renames UiError and UiErrorDetails to FrameworkError and FrameworkErrorDetails across the ui_primitives package, updating foundation, diagnostics, and value notifier components. It also includes a version bump and a new test suite for error reporting. Feedback suggests restoring removed documentation links, updating remaining string literals for consistency, and including full URLs in TODO comments.

Comment on lines +794 to 795
/// Error class used to report Framework-specific assertion failures and
/// contract violations.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The See also documentation block linking to Flutter's error handling documentation was removed. Since this class is analogous to Flutter's FlutterError, it would be beneficial to retain this link for developers familiar with the Flutter framework.

/// Error class used to report Framework-specific assertion failures and
/// contract violations.
///
/// See also:
///
///  * <https://docs.flutter.dev/testing/errors>, more information about error
///    handling in Flutter.

Comment on lines 884 to 893
ErrorSummary('Empty FlutterError'),
]),
) {
assert(
diagnostics.first.level == DiagnosticLevel.summary,
UiError.fromParts(<DiagnosticsNode>[
FrameworkError.fromParts(<DiagnosticsNode>[
ErrorSummary('FlutterError is missing a summary.'),
ErrorDescription(
'All FlutterError objects should start with a short (one line) '
'summary description of the problem that was detected.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The error messages in the assertions still refer to FlutterError. They should be updated to FrameworkError to be consistent with the refactoring.

          ErrorSummary('Empty FrameworkError'),
        ]),
      ) {
    assert(
      diagnostics.first.level == DiagnosticLevel.summary,
      FrameworkError.fromParts(<DiagnosticsNode>[
        ErrorSummary('FrameworkError is missing a summary.'),
        ErrorDescription(
          'All FrameworkError objects should start with a short (one line) '
          'summary description of the problem that was detected.',

r'#0 getSampleStack\.<anonymous closure> \([^)]+$thisTestPath:[0-9]+:[0-9]+\)\n'
r'#2 getSampleStack \([^)]+$thisTestPath:[0-9]+:[0-9]+\)\n'
r'#3 main \([^)]+$thisTestPath:[0-9]+:[0-9]+\)\n'
r'(.+\n)+', // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This TODO refers to a Flutter issue by its number. It would be more helpful to include the full URL to the issue for better context and traceability, like so: // TODO(ianh): when fixing https://github.com/flutter/flutter/issues/4021, also filter out frames...

Suggested change
r'(.+\n)+', // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
r'(.+\n)+', // TODO(ianh): when fixing https://github.com/flutter/flutter/issues/4021, also filter out frames from the test infrastructure below the first call to our main()

console.join('\n'),
matches(
_setPath(
r'^══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════\n'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The test expects 'FLUTTER FRAMEWORK' in the error output. This comes from the default library name in FrameworkErrorDetails. Given the refactoring to FrameworkError, it would be more consistent to use a more generic name like 'FRAMEWORK' here. To achieve this, you can pass a custom library name to FrameworkErrorDetails in the test setup (e.g., on line 111) and update this expectation. This applies to other similar expectations in this test file.

Suggested change
r'^══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════\n'
r'^══╡ EXCEPTION CAUGHT BY FRAMEWORK ╞═════════════════════════════════════════════════════════\n'

r'#0 getSampleStack\.<anonymous closure> \([^)]+$thisTestPath:[0-9]+:[0-9]+\)\n'
r'#2 getSampleStack \([^)]+$thisTestPath:[0-9]+:[0-9]+\)\n'
r'#3 main \([^)]+$thisTestPath:[0-9]+:[0-9]+\)\n'
r'(.+\n)+', // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This TODO refers to a Flutter issue by its number. It would be more helpful to include the full URL to the issue for better context and traceability, like so: // TODO(ianh): when fixing https://github.com/flutter/flutter/issues/4021, also filter out frames...

Suggested change
r'(.+\n)+', // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
r'(.+\n)+', // TODO(ianh): when fixing https://github.com/flutter/flutter/issues/4021, also filter out frames from the test infrastructure below the first call to our main()

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.

1 participant