Exception Handling
异常是从用户代码中发生的,无论是有意还是无意。本节介绍 spring-shell
如何处理异常并给出如何处理异常的说明和最佳实践。
Exceptions happen from a user code wether it is intentional or not. This section describes
how spring-shell
handles exceptions and gives instructions and best practices how to
work with it.
许多命令行应用程序在适用的情况下会返回 exit code,运行时环境可以使用它来区分命令是否已成功执行。在 spring-shell
中,当命令在非交互模式下运行时,这通常与它相关,这意味着一个命令始终随 spring-shell
的实例执行一次。请注意,exit code 始终与非交互式 shell 相关。
Many command line applications when applicable return an exit code which running environment
can use to differentiate if command has been executed successfully or not. In a spring-shell
this mostly relates when a command is run on a non-interactive mode meaning one command
is always executed once with an instance of a spring-shell
. Take a note that exit code
always relates to non-interactive shell.