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

NotImplemented error not being caught #60

Open
SystemsPurge opened this issue Oct 24, 2024 · 0 comments
Open

NotImplemented error not being caught #60

SystemsPurge opened this issue Oct 24, 2024 · 0 comments

Comments

@SystemsPurge
Copy link

SystemsPurge commented Oct 24, 2024

The villas-relay manager inherits its run_action from the Manager class (manager.py), where there is the following code:

def run_action(self, action, payload):
        if action == 'create':
            self.create(payload)
        elif action == 'delete':
            self.delete(payload)
        else:
            super().run_action(action, payload)

    def create(self, payload):
        raise NotImplementedError()

    def delete(self, payload):
        raise NotImplementedError()

On post, the component handler (/handlers/component.py) , does not block this:

@with_component
    def post(self, component):
        payload = json.loads(self.request.body)

        action = payload.get('action')
        if action is None:
            raise HTTPError(HTTPStatus.BAD_REQUEST)

        try:
            component.run_action(action, payload)
            self.write(component.status)

        except SimulationException as se:
            self.write({
                'exception': {
                    'msg': se.msg,
                    'args': se.args
                },
                **component.status
            })
            self.send_error(HTTPStatus.BAD_REQUEST)

As it only catches SimulationException. This seems to cause the villas-relay manager not to respond over amqp anymore.
Seems like the villas-relay manager is not made to be told explicitely when to create a component, and instead poles the villasrelay endpoint periodically then creates gateways, however two other NotImplemented errors do get raised in the rscad and rtlab simulator components, so maybe a proper response is a good idea?

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

No branches or pull requests

1 participant