proxygen
folly::ProgramExit Class Reference

#include <NestedCommandLineApp.h>

Inheritance diagram for folly::ProgramExit:

Public Member Functions

 ProgramExit (int status, const std::string &msg=std::string())
 
int status () const
 

Private Attributes

int status_
 

Detailed Description

Exception that commands may throw to force the program to exit cleanly with a given exit code. NestedCommandLineApp::run() catches this and makes run() print the given message on stderr (followed by a newline, unless empty; the message is only allowed when exiting with a non-zero status), and return the exit code. (Other exceptions will propagate out of run())

Definition at line 35 of file NestedCommandLineApp.h.

Constructor & Destructor Documentation

folly::ProgramExit::ProgramExit ( int  status,
const std::string msg = std::string() 
)
explicit

Definition at line 42 of file NestedCommandLineApp.cpp.

References folly::NestedCommandLineApp::kHelpCommand, folly::NestedCommandLineApp::kVersionCommand, and status_.

43  : std::runtime_error(msg), status_(status) {
44  // Message is only allowed for non-zero exit status
45  CHECK(status_ != 0 || msg.empty());
46 }

Member Function Documentation

int folly::ProgramExit::status ( ) const
inline

Definition at line 38 of file NestedCommandLineApp.h.

Referenced by folly::NestedCommandLineApp::run().

38  {
39  return status_;
40  }

Member Data Documentation

int folly::ProgramExit::status_
private

Definition at line 43 of file NestedCommandLineApp.h.

Referenced by ProgramExit().


The documentation for this class was generated from the following files: