Skip to content

Make the failure case of ToolkitRegistry.call more useful #1067

Open
@mattwthompson

Description

@mattwthompson

Right now, ToolkitRegistry.call tries the requested method in each of its wrapped toolkits and if they all fail, it raises a ValueError that squishes together the messages in each exception:

msg += "Available toolkits are: {}\n".format(self.registered_toolkits)
# Append information about toolkits that implemented the method, but could not handle the provided parameters
for toolkit, error in errors:
msg += " {} {} : {}\n".format(toolkit, type(error), error)
raise ValueError(msg)

A small improvement would involve raising a custom exception instead of ValueError, using mostly the same message.

cc: @j-wags who can provide more thoughts on other solutions and possibly if it's worth refactoring the design in general.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions