Exception.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "anki/util/scanner/Exception.h"
  2. #include <boost/lexical_cast.hpp>
  3. namespace scanner {
  4. //==============================================================================
  5. // Constructor =
  6. //==============================================================================
  7. Exception::Exception(const std::string& err, int errNo_,
  8. const std::string& scriptFilename_, int scriptLineNmbr_)
  9. : error(err),
  10. errNo(errNo_),
  11. scriptFilename(scriptFilename_),
  12. scriptLineNmbr(scriptLineNmbr_)
  13. {}
  14. //==============================================================================
  15. // Copy constructor =
  16. //==============================================================================
  17. Exception::Exception(const Exception& e)
  18. : error(e.error),
  19. errNo(e.errNo),
  20. scriptFilename(e.scriptFilename),
  21. scriptLineNmbr(e.scriptLineNmbr)
  22. {}
  23. //==============================================================================
  24. // what =
  25. //==============================================================================
  26. const char* Exception::what() const throw()
  27. {
  28. errWhat = "Scanner exception (#" +
  29. boost::lexical_cast<std::string>(errNo) +
  30. ":" + scriptFilename + ':' +
  31. boost::lexical_cast<std::string>(scriptLineNmbr) + "): " + error;
  32. return errWhat.c_str();
  33. }
  34. } // end namespace