Skip to content

Commit 16a4a9c

Browse files
committed
feat: add prefix to native C++ exception
1 parent 6d356f1 commit 16a4a9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

package/cpp/NitroSQLiteException.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <iostream>
55
#include <string>
66

7+
const std::string NITRO_SQLITE_EXCEPTION_PREFIX = "[NitroSQLiteException]";
8+
79
enum NitroSQLiteExceptionType {
810
UnknownError,
911
DatabaseCannotBeOpened,
@@ -33,7 +35,7 @@ class NitroSQLiteException : public std::exception {
3335
explicit NitroSQLiteException(const std::string& message) : NitroSQLiteException(NitroSQLiteExceptionType::UnknownError, message) {}
3436
NitroSQLiteException(const NitroSQLiteExceptionType& type, const char* message) : NitroSQLiteException(type, std::string(message)) {}
3537
NitroSQLiteException(const NitroSQLiteExceptionType& type, const std::string& message)
36-
: _exceptionString("[" + typeToString(type) + "] " + message) {}
38+
: _exceptionString(NITRO_SQLITE_EXCEPTION_PREFIX + " [" + typeToString(type) + "] " + message) {}
3739

3840
private:
3941
const std::string _exceptionString;

0 commit comments

Comments
 (0)