Skip to content

Commit 5692d82

Browse files
committed
Add Java Exception classes (RuntimeException, IllegalArgumentException, etc.)
1 parent 49efac0 commit 5692d82

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,6 +3636,23 @@ class PShader {
36363636

36373637

36383638

3639+
// Java Exception classes
3640+
class Exception : public ::std::exception {
3641+
::std::string msg;
3642+
public:
3643+
Exception() = default;
3644+
explicit Exception(const ::std::string& m) : msg(m) {}
3645+
const char* getMessage() const { return msg.c_str(); }
3646+
const char* what() const noexcept override { return msg.c_str(); }
3647+
};
3648+
class RuntimeException : public Exception { using Exception::Exception; };
3649+
class IllegalArgumentException : public Exception { using Exception::Exception; };
3650+
class IllegalStateException : public Exception { using Exception::Exception; };
3651+
class NullPointerException : public Exception { using Exception::Exception; };
3652+
class IndexOutOfBoundsException: public Exception { using Exception::Exception; };
3653+
class UnsupportedOperationException: public Exception { using Exception::Exception; };
3654+
class ArithmeticException : public Exception { using Exception::Exception; };
3655+
36393656
// Java Random class
36403657
class Random {
36413658
::std::mt19937 rng;

0 commit comments

Comments
 (0)