Changed exit to sys.exit

This commit is contained in:
Sven Heidemann 2022-01-19 12:43:59 +01:00
parent 83f666353f
commit 00484711ab
2 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import sys
import traceback
from cpl_core.application import ApplicationABC
@ -23,7 +24,7 @@ class Application(ApplicationABC):
self._file = config.get_configuration('-pAdditionalArguments')[1]
except Exception as e:
Console.error('Expected file')
exit()
sys.exit()
self._parser: PythonParserABC = services.get_service(PythonParserABC)
self._umlet_creator: UmletCreatorABC = services.get_service(UmletCreatorABC)
@ -68,11 +69,11 @@ class Application(ApplicationABC):
xml = self._umlet_creator.generate_xml(classes, implementations)
except Exception as e:
Console.error('Parsing failed', f'{e} -> {traceback.format_exc()}')
exit()
sys.exit()
if not self._file.endswith('.uxf'):
Console.error(f'Unexpected file {self._file}')
exit()
sys.exit()
with open(self._file, 'w+') as file:
file.write(xml)

View File

@ -1,3 +1,4 @@
import sys
import traceback
from typing import Optional
@ -96,7 +97,7 @@ class PythonParserService(PythonParserABC):
except Exception as e:
Console.error(f'Parsing {file}@{i}', f'{e} -> {traceback.format_exc()}')
file_content.close()
exit()
sys.exit()
file_content.close()
return classes
@ -149,6 +150,6 @@ class PythonParserService(PythonParserABC):
except Exception as e:
Console.error(f'Parsing {file}@{i}', f'{e} -> {traceback.format_exc()}')
file_content.close()
exit()
sys.exit()
file_content.close()
return implementations