scripting::SquirrelError Class Reference

Exception class for squirrel errors, it takes a squirrelvm and uses sq_geterror() to retrieve additional information about the last error that occurred and creates a readable message from that. More...

#include <squirrel_error.hpp>

Inherits std::exception.

List of all members.

Public Member Functions

 SquirrelError (HSQUIRRELVM v, const std::string &message) throw ()
virtual ~SquirrelError () throw ()
const char * what () const throw ()

Private Attributes

std::string message


Detailed Description

Exception class for squirrel errors, it takes a squirrelvm and uses sq_geterror() to retrieve additional information about the last error that occurred and creates a readable message from that.

Definition at line 29 of file squirrel_error.hpp.


Constructor & Destructor Documentation

scripting::SquirrelError::SquirrelError ( HSQUIRRELVM  v,
const std::string &  message 
) throw ()

Definition at line 22 of file squirrel_error.cpp.

00022                                                                             :
00023   message()
00024 {
00025   std::ostringstream msg;
00026   msg << "Squirrel error: " << message << " (";
00027   const char* lasterr;
00028   sq_getlasterror(v);
00029   if(sq_gettype(v, -1) != OT_STRING)
00030   {
00031     lasterr = "no error info";
00032   }
00033   else
00034   {
00035     sq_getstring(v, -1, &lasterr);
00036   }
00037   msg << lasterr << ")";
00038   sq_pop(v, 1);
00039   this->message = msg.str();
00040 }

scripting::SquirrelError::~SquirrelError (  )  throw () [virtual]

Definition at line 42 of file squirrel_error.cpp.

00043 {}


Member Function Documentation

const char * scripting::SquirrelError::what (  )  const throw ()

Definition at line 46 of file squirrel_error.cpp.

References message.

00047 {
00048   return message.c_str();
00049 }


Member Data Documentation

std::string scripting::SquirrelError::message [private]

Definition at line 37 of file squirrel_error.hpp.

Referenced by what().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:40 2014 for SuperTux by  doxygen 1.5.1