BASIS  r3148
except.h File Reference

Basic exceptions and related helper macros. More...

#include <sstream>
#include <stdexcept>
#include <string>
#include "tclap/ArgException.h"
+ Include dependency graph for except.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  basis

Defines

#define BASIS_THROW(type, msg)
 Throw exception with given message.

Typedefs

typedef TCLAP::ArgException basis::ArgException
 Exception thrown by command-line parsing library.
typedef TCLAP::ArgParseException basis::ArgParseException
 Exception thrown on command-line argument parsing error.
typedef
TCLAP::SpecificationException 
basis::CmdLineException
 Exception thrown when command-line specification is wrong.
typedef
TCLAP::CmdLineParseException 
basis::CmdLineParseException
 Exception thrown on command-line parsing error.
typedef TCLAP::ExitException basis::ExitException
 Exception thrown by command-line parsing library to indicate that program should exit with the given exit code.

Detailed Description

Basic exceptions and related helper macros.

Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.
See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.

Contact: SBIA Group <sbia-software at uphs.upenn.edu>

Definition in file except.h.


Define Documentation

#define BASIS_THROW (   type,
  msg 
)
Value:
{ \
       ::std::ostringstream oss; \
       oss << msg; \
       throw type(oss.str().c_str()); \
    }

Throw exception with given message.

Example:

 void func(int i) {
     if (i < 0) BASIS_THROW(std::invalid_argument, "Argument i (= " << i << ") must be positive");
 }
Parameters:
[in]typeThe type of the exception. Note that this exception type has to implement a constructor with one std::string as argument, the exception message.
[in]msgThe exception message. The given argument is streamed into a std::ostringstream.

Definition at line 46 of file except.h.