Raise generic Python exception

This commit is contained in:
Ivan Kravets
2023-07-25 12:22:41 +03:00
parent 6313042291
commit e3557760df
2 changed files with 2 additions and 16 deletions

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ajsonrpc.core import JSONRPC20DispatchException
from platformio.account.client import AccountClient
from platformio.home.rpc.handlers.base import BaseRPCHandler
@ -23,9 +21,4 @@ class AccountRPC(BaseRPCHandler):
@staticmethod
def call_client(method, *args, **kwargs):
try:
return getattr(AccountClient(), method)(*args, **kwargs)
except Exception as exc: # pylint: disable=bare-except
raise JSONRPC20DispatchException(
code=5000, message="PIO Account Call Error", data=str(exc)
) from exc
return getattr(AccountClient(), method)(*args, **kwargs)

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ajsonrpc.core import JSONRPC20DispatchException
from platformio.home.rpc.handlers.base import BaseRPCHandler
from platformio.registry.client import RegistryClient
@ -23,9 +21,4 @@ class RegistryRPC(BaseRPCHandler):
@staticmethod
def call_client(method, *args, **kwargs):
try:
return getattr(RegistryClient(), method)(*args, **kwargs)
except Exception as exc: # pylint: disable=bare-except
raise JSONRPC20DispatchException(
code=5000, message="Registry Call Error", data=str(exc)
) from exc
return getattr(RegistryClient(), method)(*args, **kwargs)