Skip to content

Commit 67b4af3

Browse files
committed
fix: implement std::runtime_error instead of std::exception
1 parent dcf77dc commit 67b4af3

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

package/cpp/NitroSQLiteException.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,15 @@ inline std::string typeToString(NitroSQLiteExceptionType type) {
2828
return exceptionTypeStrings[type];
2929
}
3030

31-
class NitroSQLiteException : public std::exception {
31+
class NitroSQLiteException : public std::runtime_error {
3232
public:
3333
explicit NitroSQLiteException(const char* message): NitroSQLiteException(NitroSQLiteExceptionType::UnknownError, message) {}
3434
explicit NitroSQLiteException(const std::string& message): NitroSQLiteException(NitroSQLiteExceptionType::UnknownError, message) {}
3535
NitroSQLiteException(const NitroSQLiteExceptionType& type, const char* message) : NitroSQLiteException(type, std::string(message)) {}
3636
NitroSQLiteException(const NitroSQLiteExceptionType& type, const std::string& message)
37-
: _exceptionString("[react-native-nitro-sqlite] " + typeToString(type) + ": " + message) {}
38-
39-
private:
40-
const std::string _exceptionString;
37+
: std::runtime_error("[react-native-nitro-sqlite] " + typeToString(type) + ": " + message) {}
4138

4239
public:
43-
[[nodiscard]] const char* what() const noexcept override {
44-
return this->_exceptionString.c_str();
45-
}
46-
4740
static NitroSQLiteException DatabaseNotOpen(const std::string& dbName) {
4841
return NitroSQLiteException(NitroSQLiteExceptionType::UnableToAttachToDatabase, dbName + " is not open");
4942
}

0 commit comments

Comments
 (0)