Skip to content

Implement error handling in console logging#120

Merged
p-hoffmann merged 2 commits into
release/v0.9.0-betafrom
p-hoffmann/patch-1
Aug 26, 2025
Merged

Implement error handling in console logging#120
p-hoffmann merged 2 commits into
release/v0.9.0-betafrom
p-hoffmann/patch-1

Conversation

@p-hoffmann

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings August 25, 2025 12:39

Copilot AI 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.

Pull Request Overview

This PR adds error handling around the console logging operation to prevent crashes when logging fails. The implementation wraps the op_user_worker_log call in a try-catch block to gracefully handle potential errors.

  • Adds try-catch error handling for the op_user_worker_log operation
  • Provides fallback error logging when the primary logging mechanism fails

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ext/runtime/js/bootstrap.js Outdated
Comment on lines +649 to +651
console.error(`Failed to log message: ${error.message}\n${level}: ${msg}`);
return;
}

Copilot AI Aug 25, 2025

Copy link

Choose a reason for hiding this comment

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

Using console.error inside the catch block creates a circular dependency since this code is defining the console object itself. This will likely cause infinite recursion or fail to work as intended. Consider using a direct logging mechanism or ops.op_user_worker_log with different parameters.

Suggested change
console.error(`Failed to log message: ${error.message}\n${level}: ${msg}`);
return;
}
// Avoid using console.error here to prevent circular dependency.
ops.op_user_worker_log(
`Failed to log message: ${error.message}\n${level}: ${msg}`,
true // Use error level
);
return;
}

Copilot uses AI. Check for mistakes.
@p-hoffmann p-hoffmann merged commit 8372040 into release/v0.9.0-beta Aug 26, 2025
5 checks passed
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