Refactor error message (#4153)

This commit is contained in:
codefiles 2026-01-21 00:39:49 -05:00 committed by GitHub
parent 78969c58c7
commit 4d2864ba76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 12 deletions

View File

@ -3,6 +3,7 @@
import importlib
import os
import sys
import textwrap
import time
import traceback
@ -100,6 +101,22 @@ def run() -> int:
return 0
def _error_message(exc: Exception) -> None:
err = ''.join(traceback.format_exception(exc))
error(err)
text = textwrap.dedent(
"""\
Archinstall experienced the above error. If you think this is a bug, please report it to
https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".
Hint: To extract the log from a live ISO
curl -F 'file=@/var/log/archinstall/install.log' https://0x0.st
"""
)
warn(text)
def main() -> int:
rc = 0
exc = None
@ -110,20 +127,11 @@ def main() -> int:
exc = e
finally:
if exc:
err = ''.join(traceback.format_exception(exc))
error(err)
text = (
'Archinstall experienced the above error. If you think this is a bug, please report it to\n'
'https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".\n\n'
"Hint: To extract the log from a live ISO \ncurl -F 'file=@/var/log/archinstall/install.log' https://0x0.st\n"
)
warn(text)
_error_message(exc)
rc = 1
sys.exit(rc)
return rc
if __name__ == '__main__':
main()
sys.exit(main())