Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User defined exceptions show as Unknown in redun console #111

Open
tesujimath opened this issue Jan 31, 2025 · 0 comments
Open

User defined exceptions show as Unknown in redun console #111

tesujimath opened this issue Jan 31, 2025 · 0 comments

Comments

@tesujimath
Copy link

Actually, it's not all user defined exceptions which do this. It's any exception class for which the constructor has multiple required parameters.

I fixed it in my case by defining default values for all but the first parameter in the constructor for the exception. Like this:

class MyCalledProcessError(Exception):
    def __init__(self, stderr: str | bytes, returncode: int = 0, cmd: List[str] = []):
        """To avoid showing as Unknown in redun console, the constructor must have only one parameter without default value."""
        self.stderr = stderr
        self.returncode = returncode
        self.cmd = cmd
        super().__init__(str(self))

My guess is that deserializing the exception from the redun database for use in the console is failing because it tries to create the exception object with only a single parameter before populating the rest. But that is a guess, I didn't have a close look at how that works.

If it is fixable that would be great. Otherwise this issue can help others who stumble over the same behaviour.

tesujimath pushed a commit to AgResearch/gbs_prism that referenced this issue Jan 31, 2025
Any exception class for which the constructor requires multiple
parameters shows as Unknown in redun console.

insitro/redun#111
tesujimath pushed a commit to AgResearch/gbs_prism that referenced this issue Jan 31, 2025
Any exception class for which the constructor requires multiple
parameters shows as Unknown in redun console.

insitro/redun#111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant