mirror of https://gitlab.com/bashrc2/epicyon
Optionally show exception text
parent
61b4d8d5c1
commit
535703a8f7
8
data.py
8
data.py
|
|
@ -16,7 +16,9 @@ def _store_base(text: str, filename: str, exception_text: str,
|
|||
with open(filename, mode, encoding='utf-8') as fp:
|
||||
fp.write(text)
|
||||
return True
|
||||
except OSError:
|
||||
except OSError as exc:
|
||||
if '[ex]' in exception_text:
|
||||
exception_text = exception_text.replace('[ex]', str(exc))
|
||||
print(exception_text)
|
||||
return False
|
||||
|
||||
|
|
@ -28,7 +30,9 @@ def load_string(filename: str, exception_text: str) -> str:
|
|||
with open(filename, 'r', encoding='utf-8') as fp:
|
||||
text = fp.read()
|
||||
return text
|
||||
except OSError:
|
||||
except OSError as exc:
|
||||
if '[ex]' in exception_text:
|
||||
exception_text = exception_text.replace('[ex]', str(exc))
|
||||
print(exception_text)
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue