您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
1.3 KiB
38 行
1.3 KiB
class UnityEnvironmentException(Exception):
|
|
"""
|
|
Related to errors starting and closing environment.
|
|
"""
|
|
pass
|
|
|
|
|
|
class UnityActionException(Exception):
|
|
"""
|
|
Related to errors with sending actions.
|
|
"""
|
|
pass
|
|
|
|
class UnityTimeOutException(Exception):
|
|
"""
|
|
Related to errors with communication timeouts.
|
|
"""
|
|
def __init__(self, message, log_file_path = None):
|
|
if log_file_path is not None:
|
|
try:
|
|
with open(log_file_path, "r") as f:
|
|
printing = False
|
|
for l in f:
|
|
l=l.strip()
|
|
if (l == 'Exception') or (l=='Error'):
|
|
printing = True
|
|
print('----------------------')
|
|
if (l == ''):
|
|
printing = False
|
|
if printing:
|
|
print(l)
|
|
print("An error might have occured in the environment. "
|
|
"You can check the logfile for more information at {}".format(log_file_path))
|
|
except:
|
|
print("An error might have occured in the environment. "
|
|
"No unity-environment.log file could be found.")
|
|
super(UnityTimeOutException, self).__init__(message)
|
|
|