jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.2KB

  1. /*
  2. Copyright (C) 2008 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifndef __JackException__
  16. #define __JackException__
  17. #include <stdexcept>
  18. #include <iostream>
  19. #include <string>
  20. #include "JackError.h"
  21. namespace Jack
  22. {
  23. class JackException : public std::runtime_error {
  24. public:
  25. JackException(const std::string& msg) : runtime_error(msg)
  26. {}
  27. JackException(const char* msg) : runtime_error(msg)
  28. {}
  29. std::string Message()
  30. {
  31. return what();
  32. }
  33. void PrintMessage()
  34. {
  35. std::string str = what();
  36. jack_info(str.c_str());
  37. }
  38. };
  39. class JackDriverException : public JackException {
  40. public:
  41. JackDriverException(const std::string& msg) : JackException(msg)
  42. {}
  43. JackDriverException(const char* msg) : JackException(msg)
  44. {}
  45. };
  46. }
  47. #endif
  48. /*
  49. Copyright (C) 2008 Grame
  50. This program is free software; you can redistribute it and/or modify
  51. it under the terms of the GNU General Public License as published by
  52. the Free Software Foundation; either version 2 of the License, or
  53. (at your option) any later version.
  54. This program is distributed in the hope that it will be useful,
  55. but WITHOUT ANY WARRANTY; without even the implied warranty of
  56. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  57. GNU General Public License for more details.
  58. You should have received a copy of the GNU General Public License
  59. along with this program; if not, write to the Free Software
  60. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  61. */
  62. #ifndef __JackException__
  63. #define __JackException__
  64. #include <stdexcept>
  65. #include <iostream>
  66. #include <string>
  67. #include "JackError.h"
  68. namespace Jack
  69. {
  70. class JackException : public std::runtime_error {
  71. public:
  72. JackException(const std::string& msg) : runtime_error(msg)
  73. {}
  74. JackException(const char* msg) : runtime_error(msg)
  75. {}
  76. std::string Message()
  77. {
  78. return what();
  79. }
  80. void PrintMessage()
  81. {
  82. std::string str = what();
  83. jack_error(str.c_str());
  84. }
  85. };
  86. class JackDriverException : public JackException {
  87. public:
  88. JackDriverException(const std::string& msg) : JackException(msg)
  89. {}
  90. JackDriverException(const char* msg) : JackException(msg)
  91. {}
  92. };
  93. }
  94. #endif