Skip to content

Remove: Remove stack trace and error code from error screen - #21450

Merged
TiagoJacobs merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
Tainan404:remove-stack-trace-error-screen
Oct 16, 2024
Merged

TiagoJacobs merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
Tainan404:remove-stack-trace-error-screen

Conversation

@Tainan404

@Tainan404 Tainan404 commented Oct 15, 2024 •

Copy link
Copy Markdown
Member

What does this PR do?

This PR removes the stack trace from error screen to reduce the polution and not mislead the user, also removes the error code, because no pattern is followed and could cause misunderstanding of whats happening.

OBS: Future Refactor needed, relating errors and the codes so this item can be restored. #21455

How to test

Run the command sudo bbb-conf --restart in the server.

More.

New:
image

Old:
image

@Tainan404
Tainan404 requested a review from TiagoJacobs October 15, 2024 22:54
@coderabbitai

coderabbitai Bot commented Oct 15, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes in the pull request involve modifications primarily to the ErrorScreen component and its interactions with other components, specifically CustomUsersSettings and SettingsLoader. In the ErrorScreen component, the errorInfo and code props have been removed from both the propTypes and defaultProps, indicating that these properties are no longer expected or utilized. The rendering logic that conditionally displayed a <textarea> for errorInfo has been eliminated, allowing the component to focus solely on displaying error messages based on the error prop and messages retrieved from session storage.

Additionally, the CustomUsersSettings and SettingsLoader components have been updated to remove the lines that passed the code prop to the ErrorScreen, altering how error codes are handled and potentially affecting the representation of errors in the UI. The overall structure and logic of these components remain intact, with no alterations made to their exported or public entities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CustomUsersSettings
    participant SettingsLoader
    participant ErrorScreen

    User->>CustomUsersSettings: Trigger error
    CustomUsersSettings->>ErrorScreen: Render without code
    User->>SettingsLoader: Trigger error
    SettingsLoader->>ErrorScreen: Render without code
    ErrorScreen->>User: Show error message
Loading

Possibly related PRs

  • Fix: close event emitting a terminal error #21299: The changes in the ConnectionManager component's error handling logic may relate to the overall error management strategy in the application, which could impact how errors are reported and handled across different components, including the ErrorScreen.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
bigbluebutton-html5/imports/ui/components/common/error-boundary/component.jsx (1)

Line range hint 39-86: Consider refactoring error handling for consistency

While the errorInfo has been removed from the Fallback component, it's still being captured in componentDidCatch and logged in componentDidUpdate. This approach maintains error tracking capabilities for developers while simplifying the user-facing error display, which aligns with the PR objectives.

However, for consistency and to potentially simplify the component further, consider the following suggestions:

  1. If errorInfo is no longer needed for display purposes, you might want to remove it from the component's state.
  2. Update the componentDidCatch and componentDidUpdate methods to only work with the error object, unless errorInfo is still necessary for logging purposes.

Here's a potential refactor to consider:

 constructor(props) {
   super(props);
-  this.state = { error: '', errorInfo: null };
+  this.state = { error: null };
 }

 componentDidUpdate() {
-  const { error, errorInfo } = this.state;
+  const { error } = this.state;
   const { logMetadata: { logCode, logMessage } } = this.props;
-  if (error || errorInfo) {
+  if (error) {
     logger.error({
       logCode,
       extraInfo: {
         errorMessage: error?.message,
         errorStack: error?.stack,
-        errorInfo,
       },
     }, logMessage);
   }
 }

-componentDidCatch(error, errorInfo) {
+componentDidCatch(error) {
   // ... (existing code)

   this.setState({
     error,
-    errorInfo,
   });
 }

This refactor would streamline the error handling process and make it consistent with the removal of errorInfo from the user-facing components. However, please ensure that removing errorInfo from logging doesn't impact your ability to debug issues effectively.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3f22a22 and 740bc82.

📒 Files selected for processing (2)
  • bigbluebutton-html5/imports/ui/components/common/error-boundary/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (0 hunks)
💤 Files with no reviewable changes (1)
  • bigbluebutton-html5/imports/ui/components/error-screen/component.jsx
🧰 Additional context used
🔇 Additional comments (3)
bigbluebutton-html5/imports/ui/components/common/error-boundary/component.jsx (3)

Line range hint 118-123: HOC withErrorBoundary remains compatible

The higher-order component withErrorBoundary remains unchanged and compatible with the updated ErrorBoundary component. It continues to wrap components with ErrorBoundary, passing the FallbackComponent as expected.

This consistency ensures that existing uses of withErrorBoundary in the codebase will automatically benefit from the removal of the stack trace in error displays without requiring additional changes.


Line range hint 1-123: Summary: Effective removal of stack trace from error display

The changes in this file successfully achieve the PR objective of removing the stack trace from the error screen. Key points:

  1. The errorInfo prop has been removed from the Fallback component in the render method, simplifying the error display for users.
  2. Error logging for developers is maintained in componentDidCatch and componentDidUpdate, preserving debugging capabilities.
  3. The withErrorBoundary HOC remains compatible with these changes, ensuring consistent behavior across the application.

These modifications improve the user experience by reducing potentially confusing technical information in error messages while maintaining necessary error tracking for developers.

The implementation effectively balances user experience improvements with developer needs. Consider the earlier suggestions for potential further refinements to error handling consistency.


105-105: Removal of errorInfo prop aligns with PR objectives

The change on this line removes the errorInfo prop from the Fallback component, which aligns with the PR objective of removing the stack trace from the error screen. This modification simplifies the error display and prevents potential confusion for users who might misinterpret the stack trace information.

To ensure that this change is consistent throughout the codebase, let's verify that the Fallback component (likely the ErrorScreen) no longer uses the errorInfo prop:

If these searches return no results, it confirms that the errorInfo prop has been consistently removed from the ErrorScreen component.

@Tainan404 Tainan404 changed the title Remove: Remove stack trace from error screen Remove: Remove stack trace and error code from error screen Oct 16, 2024

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (2)

124-124: LGTM: Simplified error message handling

The changes in the render method align well with the PR objective. Setting a default user-friendly error message and removing the errorInfo rendering logic simplifies the component's output and reduces potential confusion for users.

Consider using the intl.formatMessage function for the default error message to ensure consistency with other translated messages:

const formatedMessage = intl.formatMessage(intlMessages['500']);

Line range hint 1-168: LGTM: Successfully removed stack trace from error screen

The changes to the ErrorScreen component successfully achieve the PR objective of removing the stack trace from the error screen. The removal of code and errorInfo props, along with the simplification of the component's logic, reduces visual clutter and potential confusion for users.

Consider updating the component's documentation or adding a comment to explain the rationale behind removing the stack trace. This will help future developers understand the design decision:

// The stack trace has been removed from the error screen to reduce visual clutter
// and prevent potential confusion for users who may misinterpret the information.
class ErrorScreen extends PureComponent {
  // ...
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 740bc82 and 877182c.

📒 Files selected for processing (3)
  • bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/join-handler/custom-users-settings/component.tsx (0 hunks)
  • bigbluebutton-html5/imports/ui/components/settings-loader/component.tsx (0 hunks)
💤 Files with no reviewable changes (2)
  • bigbluebutton-html5/imports/ui/components/join-handler/custom-users-settings/component.tsx
  • bigbluebutton-html5/imports/ui/components/settings-loader/component.tsx
🧰 Additional context used
🔇 Additional comments (1)
bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (1)

112-116: LGTM: Simplified error logging

The removal of the code prop from the error logging is consistent with the PR objective to remove stack traces from the error screen. This change simplifies the error logging without losing essential information and aligns with the modifications in propTypes and defaultProps.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
bigbluebutton-html5/imports/ui/components/connection-manager/component.tsx (1)

Line range hint 70-78: Improved error logging in errorLink function

The use of logger.error for logging GraphQL errors is a good improvement over console.log. It provides better error tracking and aligns with the project's logging practices.

However, consider adding more context to the error log:

Consider modifying the error logging to include more context:

 const errorLink = onError(({ graphQLErrors, networkError }) => {
   if (graphQLErrors) {
-    graphQLErrors.forEach(({ message }) => {
-      logger.error(`[GraphQL error]: Message: ${message}`);
+    graphQLErrors.forEach(({ message, locations, path }) => {
+      logger.error(`[GraphQL error]: Message: ${message}, Location: ${JSON.stringify(locations)}, Path: ${path}`);
     });
   }

   if (networkError) {
     logger.error(`[Network error]: ${networkError}`);
   }
 });

This change will provide more detailed information about GraphQL errors, including the location and path of the error, which can be helpful for debugging.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 877182c and 7960d4b.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/connection-manager/component.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
bigbluebutton-html5/imports/ui/components/connection-manager/component.tsx (2)

Line range hint 1-385: Overall impact of changes and alignment with PR objective

The changes in this file focus on improving error handling and logging, which is beneficial for debugging and maintenance. However, these modifications don't directly address the main PR objective of removing stack traces and error codes from the error screen.

To ensure the PR's main objective is met:

  1. Verify that the stack traces and error codes are indeed removed from the error screen:
#!/bin/bash
# Search for any remaining references to stack traces or error codes in the error screen component
rg --type typescript "stack|trace|error.*code" bigbluebutton-html5/imports/ui/components/error-screen/
  1. Check if there are any other files modified in this PR that directly handle the error screen display:
#!/bin/bash
# List all modified files in the PR
gh pr view 21450 --json files --jq '.files[].path'

If there are other relevant files, they should be reviewed to ensure the PR's main objective is achieved.


4-4: LGTM: New import for GraphQLError

The addition of GraphQLError import from the 'graphql' package is a good practice for more precise error typing. This aligns with improving error handling, which is indirectly related to the PR's objective.

To ensure this import is being utilized effectively:

@TiagoJacobs

Copy link
Copy Markdown
Member

Hello @Tainan404

please remove this line:
image

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (2)

112-116: Approve changes with a minor suggestion for error logging.

The removal of the code prop from the console error message is consistent with the PR objectives. This change simplifies the error logging without losing essential information.

Consider adding more context to the error message to compensate for the removed code. For example:

console.error(
  { logCode: 'startup_client_usercouldnotlogin_error' },
  'User could not log in to HTML5 client',
  error
);

This way, you're logging the actual error object, which might provide more useful debugging information.


124-124: Approve changes with suggestions for improvement.

The removal of the code-based message is in line with the PR objectives. However, consider the following improvements:

  1. Instead of hardcoding the message, consider using the intl.formatMessage() function for internationalization:
const formattedMessage = intl.formatMessage(intlMessages['500']);
  1. Fix the typo in the variable name from 'formatedMessage' to 'formattedMessage'.

  2. Consider implementing a more flexible error message system that doesn't rely on error codes but still provides meaningful information to users.

Would you like assistance in implementing these suggestions?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7960d4b and 7a7c199.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
bigbluebutton-html5/imports/ui/components/error-screen/component.jsx (1)

Line range hint 1-1: Approve prop changes with a verification suggestion.

The removal of code and errorInfo props from both propTypes and defaultProps is consistent with the PR objectives and simplifies the component's interface.

To ensure that these changes don't cause issues elsewhere in the application, please run the following script to check for any remaining usage of these props:

If this script returns any results, those locations may need to be updated to remove the unused prop passing.

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@TiagoJacobs
TiagoJacobs merged commit f919039 into bigbluebutton:v3.0.x-release Oct 16, 2024
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.

2 participants