Skip to content

Filter stack trace in ConfigParser#1275

Merged
jmthomas merged 5 commits intomainfrom
stack_trace
May 22, 2024
Merged

Filter stack trace in ConfigParser#1275
jmthomas merged 5 commits intomainfrom
stack_trace

Conversation

@jmthomas
Copy link
Copy Markdown
Member

closes #1255

@jmthomas jmthomas requested a review from ryanmelt May 16, 2024 14:12
message += "\n#{File.basename(error.filename)}:#{error.line_number}: #{error.line}"
message += "\nError: #{error.message}"
message += "\nUsage: #{error.usage}" unless error.usage.empty?
message += "\nBacktrace:"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This backtrace is really useful when there are bugs in COSMOS itself. Maybe just comment out these lines or make them debug logs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or have the backtrace on only the first error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We never want the backtrace on a ConfigParser::Error because those are special errors we're creating.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are sometime that we do (mainly because we are using parser.error incorrectly).
Please make sure that these lines in packet_config.rb:
raise parser.error(e)
Include the backtrace.
Also in any of the sub_parsers like limits_response_parser.rb

message += "\n#{File.basename(error.filename)}:#{error.line_number}: #{error.line}"
message += "\nError: #{error.message}"
message += "\nUsage: #{error.usage}" unless error.usage.empty?
message += "\nBacktrace:"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or have the backtrace on only the first error?

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
47.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@jmthomas jmthomas merged commit 9b071ba into main May 22, 2024
@jmthomas jmthomas deleted the stack_trace branch May 22, 2024 16:54
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.

Filter install error stack trace

2 participants