How to use the odoorpc.rpc.error.ConnectorError function in OdooRPC

To help you get started, we’ve selected a few OdooRPC examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OCA / odoorpc / odoorpc / rpc / service.py View on Github external
self._sock = xmlrpclib_custom.TimeoutServerProxy(
                    self._url, allow_none=True,
                    timeout=self._connector.timeout)
                sock_method = getattr(self._sock, method, False)
                return sock_method(*args)
            #NOTE: exception raised with these kind of requests:
            #   - execute('fake.model', 'search', [])
            #   - execute('sale.order', 'fake_method')
            except xmlrpclib.Fault as exc:
                # faultCode: error message
                # faultString: Server traceback (following the server version
                # used, a bad request can produce a server traceback, or not).
                raise error.ConnectorError(exc.faultCode, exc.faultString)
            #TODO NEED TEST (when is raised this exception?)
            except xmlrpclib.Error as exc:
                raise error.ConnectorError(' - '.join(exc.args))
        return rpc_method
github osiell / odoorpc / odoorpc / rpc / service.py View on Github external
self._sock = xmlrpclib_custom.TimeoutServerProxy(
                    self._url, allow_none=True,
                    timeout=self._connector.timeout)
                sock_method = getattr(self._sock, method, False)
                return sock_method(*args)
            #NOTE: exception raised with these kind of requests:
            #   - execute('fake.model', 'search', [])
            #   - execute('sale.order', 'fake_method')
            except xmlrpclib.Fault as exc:
                # faultCode: error message
                # faultString: Server traceback (following the server version
                # used, a bad request can produce a server traceback, or not).
                raise error.ConnectorError(exc.faultCode, exc.faultString)
            #TODO NEED TEST (when is raised this exception?)
            except xmlrpclib.Error as exc:
                raise error.ConnectorError(' - '.join(exc.args))
        return rpc_method