Skip to content
Prev Previous commit
Next Next commit
JIRA WDT-638 - handle sys.exit(). Ensure exception type is always pri…
…nted/logged.
  • Loading branch information
jwgish committed Jul 19, 2022
commit c095f195bb2cf26f57b8dc96227002c6581cdf99
2 changes: 2 additions & 0 deletions core/src/main/python/compare_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,5 +351,7 @@ def format_message(key, *args):
if __name__ == "__main__":
try:
main()
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, _logger)
3 changes: 2 additions & 1 deletion core/src/main/python/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)

2 changes: 2 additions & 0 deletions core/src/main/python/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
3 changes: 2 additions & 1 deletion core/src/main/python/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)

2 changes: 2 additions & 0 deletions core/src/main/python/encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
2 changes: 2 additions & 0 deletions core/src/main/python/extract_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
2 changes: 2 additions & 0 deletions core/src/main/python/model_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
2 changes: 2 additions & 0 deletions core/src/main/python/prepare_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@ def main():
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main()
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
2 changes: 2 additions & 0 deletions core/src/main/python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
2 changes: 2 additions & 0 deletions core/src/main/python/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
2 changes: 2 additions & 0 deletions core/src/main/python/variable_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,7 @@ def main(args):
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
try:
main(sys.argv)
except exceptions.SystemExit, ex:
raise ex
except (exceptions.Exception, java.lang.Exception), ex:
exception_helper.__handleUnexpectedException(ex, _program_name, _class_name, __logger)
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def __handleUnexpectedException(ex, program_name, class_name, logger):
:param class_name: the class where it occurred
:param logger: the logger to use
"""
logger.severe('WLSDPLY-20035', program_name, ex)
logger.severe('WLSDPLY-20035', program_name, sys.exc_info()[0])

if hasattr(ex, 'stackTrace'):
# this works best for java exceptions, and gets the full stacktrace all the way back to weblogic.WLST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ WLSDPLY-20031={0} specified Variable File {1} is not a valid file: {2}
WLSDPLY-20032=No model specified and no model in archive, no validation performed
WLSDPLY-20033=Applying filter with name "{0}"
WLSDPLY-20034=Applying filter with ID "{0}"
WLSDPLY-20035={0} encountered an unexpected runtime exception. Please file an issue on GitHub and attach the log file and stdout. Error: {1}
WLSDPLY-20035={0} encountered an unexpected runtime exception. Please file an issue on GitHub and attach the log file and stdout. Exception: {1}
WLSDPLY-20036={0} encountered an unexpected runtime exception. Stacktrace: {1}

# Messages for internal filters
Expand Down