Appearance
swbpy2.core.exception 模块
概述
swbpy2.core.exception 包含用于处理仿真树操作中特定错误条件的 Exception 类。请参考 Examples 获取用例代码。
类和方法列表
exception swbpy2.core.exception.TreeException(msg, *args)
基类:ABC, Exception, TreeException
swbpy2.core.core.SWBTreeException 实体的客户端类。
参数:
msg(str):异常消息。
TreeException.what()
获取 TreeException 消息的抽象方法。
返回:异常消息。类型:str
示例
以下是 swbpy2.core.exception.TreeException 类型异常的使用示例。
python
import time
from swbpy2.gtree.Deck import Deck
from swbpy2.core.exception import TreeException
# 构造仿真对象
_deck = Deck('/u/username/Applications_Library/GettingStarted/swb/SimpleMOS/')
_timeout = 120
# 执行 SWB 项目
_deck.run()
# 等待超时
time.sleep(_timeout)
# 检查项目状态
if _deck.status() in ('running', 'ready', 'queued', 'pending'):
raise TreeException('The execution of the SWB Project is taking more than %d seconds' % _timeout)