13f085823Sopenharmony_ci#!/usr/bin/env python3 23f085823Sopenharmony_ci# coding=utf-8 33f085823Sopenharmony_ci 43f085823Sopenharmony_ci# 53f085823Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd. 63f085823Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 73f085823Sopenharmony_ci# you may not use this file except in compliance with the License. 83f085823Sopenharmony_ci# You may obtain a copy of the License at 93f085823Sopenharmony_ci# 103f085823Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 113f085823Sopenharmony_ci# 123f085823Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 133f085823Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 143f085823Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 153f085823Sopenharmony_ci# See the License for the specific language governing permissions and 163f085823Sopenharmony_ci# limitations under the License. 173f085823Sopenharmony_ci# 183f085823Sopenharmony_ci 193f085823Sopenharmony_ci 203f085823Sopenharmony_ciclass ParamError(Exception): 213f085823Sopenharmony_ci def __init__(self, error_msg): 223f085823Sopenharmony_ci super().__init__() 233f085823Sopenharmony_ci self.error_msg = error_msg 243f085823Sopenharmony_ci 253f085823Sopenharmony_ci def __str__(self): 263f085823Sopenharmony_ci return "ParamError: %s" % self.error_msg 273f085823Sopenharmony_ci 283f085823Sopenharmony_ci 293f085823Sopenharmony_ciclass LiteDeviceConnectError(Exception): 303f085823Sopenharmony_ci def __init__(self, error_msg): 313f085823Sopenharmony_ci super().__init__() 323f085823Sopenharmony_ci self.error_msg = error_msg 333f085823Sopenharmony_ci 343f085823Sopenharmony_ci def __str__(self): 353f085823Sopenharmony_ci return "LiteDeviceConnectError: %s" % self.error_msg 363f085823Sopenharmony_ci 373f085823Sopenharmony_ci 383f085823Sopenharmony_ciclass DeviceNotExistError(Exception): 393f085823Sopenharmony_ci def __init__(self, error_msg): 403f085823Sopenharmony_ci super().__init__() 413f085823Sopenharmony_ci self.error_msg = error_msg 423f085823Sopenharmony_ci 433f085823Sopenharmony_ci def __str__(self): 443f085823Sopenharmony_ci return "DeviceNotExistError: %s" % self.error_msg 453f085823Sopenharmony_ci 463f085823Sopenharmony_ci 473f085823Sopenharmony_ciclass DeviceCommandRejectedException(Exception): 483f085823Sopenharmony_ci """ 493f085823Sopenharmony_ci Exception thrown when device refuses a command. 503f085823Sopenharmony_ci """ 513f085823Sopenharmony_ci def __init__(self, value): 523f085823Sopenharmony_ci super().__init__() 533f085823Sopenharmony_ci self.value = value 543f085823Sopenharmony_ci 553f085823Sopenharmony_ci def __str__(self): 563f085823Sopenharmony_ci return "DeviceCommandRejectedException: %s" % self.value 573f085823Sopenharmony_ci 583f085823Sopenharmony_ci 593f085823Sopenharmony_ciclass ShellCommandUnresponsiveException(Exception): 603f085823Sopenharmony_ci """ 613f085823Sopenharmony_ci Exception thrown when a shell command executed on a device takes 623f085823Sopenharmony_ci too long to send its output. 633f085823Sopenharmony_ci """ 643f085823Sopenharmony_ci def __str__(self): 653f085823Sopenharmony_ci return "ShellCommandUnresponsiveException" 66