On MS-DOS, the programmer can check if the previous command has exit with error by checking the %ERRORLEVEL% variable. How this can be done on MSX-DOS2/Nextor?
If you use TNI's COMMAND2.COM, you can create .BTM files that have extended functionality. There's also support for error codes. This is a snippet from the ENV.HLP help file:
_ERROR: This is the error code of the previous command. See
the "Program Interface Specification" for a list of all the
currently defined error codes and the messages for them.
(For example "215" for "File not found", "142" for
"Unrecognized command", "0" for no error.)