mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Raise generic Python exception
This commit is contained in:
@ -12,8 +12,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ajsonrpc.core import JSONRPC20DispatchException
|
|
||||||
|
|
||||||
from platformio.account.client import AccountClient
|
from platformio.account.client import AccountClient
|
||||||
from platformio.home.rpc.handlers.base import BaseRPCHandler
|
from platformio.home.rpc.handlers.base import BaseRPCHandler
|
||||||
|
|
||||||
@ -23,9 +21,4 @@ class AccountRPC(BaseRPCHandler):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def call_client(method, *args, **kwargs):
|
def call_client(method, *args, **kwargs):
|
||||||
try:
|
return getattr(AccountClient(), method)(*args, **kwargs)
|
||||||
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
|
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ajsonrpc.core import JSONRPC20DispatchException
|
|
||||||
|
|
||||||
from platformio.home.rpc.handlers.base import BaseRPCHandler
|
from platformio.home.rpc.handlers.base import BaseRPCHandler
|
||||||
from platformio.registry.client import RegistryClient
|
from platformio.registry.client import RegistryClient
|
||||||
|
|
||||||
@ -23,9 +21,4 @@ class RegistryRPC(BaseRPCHandler):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def call_client(method, *args, **kwargs):
|
def call_client(method, *args, **kwargs):
|
||||||
try:
|
return getattr(RegistryClient(), method)(*args, **kwargs)
|
||||||
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
|
|
||||||
|
Reference in New Issue
Block a user