Skip to content

[thermalctld] Print exception using repr(e) to get more information#103

Merged
jleveque merged 1 commit intosonic-net:masterfrom
Junchao-Mellanox:fix-print-exception
Oct 19, 2020
Merged

[thermalctld] Print exception using repr(e) to get more information#103
jleveque merged 1 commit intosonic-net:masterfrom
Junchao-Mellanox:fix-print-exception

Conversation

@Junchao-Mellanox
Copy link
Collaborator

Why I did this?

The existing code print exception like:

self.log_error('Caught exception while initializing thermal manager - {}'.format(e))

And it would print empty string if the exception class doesn't implement str. And the empty string is useless for debugging.

How to fix it?

Always print the exception using repr(e), like:

self.log_error('Caught exception while initializing thermal manager - {}'.format(repr(e)))

@jleveque jleveque merged commit 61ed24e into sonic-net:master Oct 19, 2020
@Junchao-Mellanox Junchao-Mellanox deleted the fix-print-exception branch October 20, 2020 01:06
@abdosi
Copy link
Contributor

abdosi commented Oct 30, 2020

@liat-grozovik Cherry-pick has conflict.

Junchao-Mellanox added a commit to Junchao-Mellanox/sonic-platform-daemons that referenced this pull request Nov 2, 2020
…onic-net#103)

Allow exceptions to be printed even if they don't inherit from the `str` class
Conflicts:
	sonic-thermalctld/scripts/thermalctld
liat-grozovik pushed a commit that referenced this pull request Nov 3, 2020
…103) (#109)

Allow exceptions to be printed even if they don't inherit from the `str` class
Conflicts:
	sonic-thermalctld/scripts/thermalctld
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
…nic-net#103)

As part of consolidating all common Python-based functionality into the new sonic-py-common package, this pull request migrates from importing the sonic-daemon-base package to importing the sonic-py-common package. This is the next step toward resolving sonic-net/sonic-buildimage#4999.

- Also reorganize imports for consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants