Sqlite: Extend error handling

We do only handled errors for the v1 interface. Now we handle much more.
Sadly this is hard to test, so there are no tests.

Change-Id: I6f55dc1bad744776bb33a6d0d6c71e52d2f097f6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2020-06-16 00:05:33 +02:00
committed by Tim Jenssen
parent 1b6a0a290b
commit ce942bd33c
3 changed files with 206 additions and 14 deletions

View File

@@ -91,10 +91,10 @@ public:
}
};
class IoError : public Exception
class InputOutputError : public Exception
{
public:
IoError(const char *whatErrorHasHappen)
InputOutputError(const char *whatErrorHasHappen)
: Exception(whatErrorHasHappen)
{
}
@@ -267,6 +267,14 @@ public:
}
};
class TooBig : public Exception
{
public:
TooBig(const char *whatErrorHasHappen, Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class CannotConvert : public Exception
{
public:
@@ -299,4 +307,84 @@ public:
{}
};
class SchemeChangeError : public Exception
{
public:
SchemeChangeError(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class CannotWriteToReadOnlyConnection : public Exception
{
public:
CannotWriteToReadOnlyConnection(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class ProtocolError : public Exception
{
public:
ProtocolError(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class DatabaseExceedsMaximumFileSize : public Exception
{
public:
DatabaseExceedsMaximumFileSize(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class DataTypeMismatch : public Exception
{
public:
DataTypeMismatch(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class ConnectionIsLocked : public Exception
{
public:
ConnectionIsLocked(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class ExecutionInterrupted : public Exception
{
public:
ExecutionInterrupted(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class DatabaseIsCorrupt : public Exception
{
public:
DatabaseIsCorrupt(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
class CannotOpen : public Exception
{
public:
CannotOpen(const char *whatErrorHasHappen,
Utils::SmallString &&errorMessage = Utils::SmallString())
: Exception(whatErrorHasHappen, std::move(errorMessage))
{}
};
} // namespace Sqlite