Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/nodejs/src/node_exit_code.h
1 #ifndef SRC_NODE_EXIT_CODE_H_ 2 #define SRC_NODE_EXIT_CODE_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 namespace node { 7 #define EXIT_CODE_LIST(V) \ 8 V(NoFailure, 0) \ 9 /* 1 was intended for uncaught JS exceptions from the user land but we */ \ 10 /* actually use this for all kinds of generic errors. */ \ 11 V(GenericUserError, 1) \ 12 /* 2 is unused */ \ 13 /* 3 is actually unused because we pre-compile all builtins during */ \ 14 /* snapshot building, when we exit with 1 if there's any error. */ \ 15 V(InternalJSParseError, 3) \ 16 /* 4 is actually unused. We exit with 1 in this case. */ \ 17 V(InternalJSEvaluationFailure, 4) \ 18 /* 5 is actually unused. We exit with 133 (128+SIGTRAP) or 134 */ \ 19 /* (128+SIGABRT) in this case. */ \ 20 V(V8FatalError, 5) \ 21 V(InvalidFatalExceptionMonkeyPatching, 6) \ 22 V(ExceptionInFatalExceptionHandler, 7) \ 23 /* 8 is unused */ \ 24 V(InvalidCommandLineArgument, 9) \ 25 V(BootstrapFailure, 10) \ 26 /* 11 is unused */ \ 27 /* This was intended for invalid inspector arguments but is actually now */ \ 28 /* just a duplicate of InvalidCommandLineArgument */ \ 29 V(InvalidCommandLineArgument2, 12) \ 30 V(UnsettledTopLevelAwait, 13) \ 31 V(StartupSnapshotFailure, 14) \ 32 /* If the process exits from unhandled signals e.g. SIGABRT, SIGTRAP, */ \ 33 /* typically the exit codes are 128 + signal number. We also exit with */ \ 34 /* certain error codes directly for legacy reasons. Here we define those */ \ 35 /* that are used to normalize the exit code on Windows. */ \ 36 V(Abort, 134) 37 38 // TODO(joyeecheung): expose this to user land when the codes are stable. 39 // The underlying type should be an int, or we can get undefined behavior when 40 // casting error codes into exit codes (technically we shouldn't do that, 41 // but that's how things have been). 42 enum class ExitCode : int { 43 #define V(Name, Code) k##Name = Code, 44 EXIT_CODE_LIST(V) 45 #undef V 46 }; 47 48 [[noreturn]] void Exit(ExitCode exit_code); 49 50 } // namespace node 51 52 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 53 54 #endif // SRC_NODE_EXIT_CODE_H_