libmanta
A cross-platform API for the Snyderphonics Manta
MantaExceptions.h
00001 #ifndef _MANTAEXCEPTIONS_H
00002 #define _MANTAEXCEPTIONS_H
00003 
00004 #include <stdexcept>
00005 
00006 class LibusbInitException : public std::runtime_error
00007 {
00008    public:
00009       LibusbInitException() :
00010             runtime_error("Error initializing libusb")
00011          {
00012          }
00013 };
00014 
00015 class MantaNotConnectedException : public std::runtime_error
00016 {
00017    public:
00018       MantaNotConnectedException(MantaUSB *manta) :
00019             runtime_error("Attempted to access the Manta without connecting"),
00020             errorManta(manta)
00021          {
00022          }
00023       MantaUSB *errorManta;
00024 };
00025 
00026 class MantaNotFoundException : public std::runtime_error
00027 {
00028    public:
00029       MantaNotFoundException() :
00030             runtime_error("Could not find an attached Manta")
00031          {
00032          }
00033 };
00034 
00035 class MantaOpenException : public std::runtime_error
00036 {
00037    public:
00038       MantaOpenException() :
00039             runtime_error("Could not connect to attached Manta")
00040          {
00041          }
00042 };
00043 
00044 class MantaCommunicationException : public std::runtime_error
00045 {
00046    public:
00047       MantaCommunicationException(MantaUSB *manta = NULL) :
00048             runtime_error("Communication with Manta interrupted"),
00049             errorManta(manta)
00050          {
00051          }
00052       MantaUSB *errorManta;
00053 };
00054 
00055 #endif // _MANTAEXCEPTIONS_H