Exception

class OCP\DB\Exception
Database exception
Thrown by Nextcloud’s database abstraction layer. This is the base class that
any specific exception will extend. Use this class in your try-catch to catch
*any* error related to the database. Use any of the subclasses in the same
namespace if you are only interested in specific errors.
Source:lib/public/DB/Exception.php#41
Parent:Exception

Constants

REASON_CONNECTION_LOST = 1
Nextcloud lost connection to the database
Source:lib/public/DB/Exception.php#48
Since:21.0.0
REASON_CONSTRAINT_VIOLATION = 2
A database constraint was violated
Source:lib/public/DB/Exception.php#55
Since:21.0.0
REASON_DATABASE_OBJECT_EXISTS = 3
A database object (table, column, index) already exists
Source:lib/public/DB/Exception.php#62
Since:21.0.0
REASON_DATABASE_OBJECT_NOT_FOUND = 4
A database object (table, column, index) can’t be found
Source:lib/public/DB/Exception.php#69
Since:21.0.0
REASON_DEADLOCK = 5
The database ran into a deadlock
Source:lib/public/DB/Exception.php#76
Since:21.0.0
REASON_DRIVER = 6
The database driver encountered an issue
Source:lib/public/DB/Exception.php#83
Since:21.0.0
REASON_FOREIGN_KEY_VIOLATION = 7
A foreign key constraint was violated
Source:lib/public/DB/Exception.php#90
Since:21.0.0
REASON_INVALID_ARGUMENT = 8
An invalid argument was passed to the database abstraction
Source:lib/public/DB/Exception.php#97
Since:21.0.0
REASON_INVALID_FIELD_NAME = 9
A field name was invalid
Source:lib/public/DB/Exception.php#104
Since:21.0.0
REASON_NON_UNIQUE_FIELD_NAME = 10
A name in the query was ambiguous
Source:lib/public/DB/Exception.php#111
Since:21.0.0
REASON_NOT_NULL_CONSTRAINT_VIOLATION = 11
A not null contraint was violated
Source:lib/public/DB/Exception.php#118
Since:21.0.0
REASON_SERVER = 12
A generic server error was encountered
Source:lib/public/DB/Exception.php#125
Since:21.0.0
REASON_SYNTAX_ERROR = 13
A syntax error was reported by the server
Source:lib/public/DB/Exception.php#132
Since:21.0.0
REASON_UNIQUE_CONSTRAINT_VIOLATION = 14
A unique constraint was violated
Source:lib/public/DB/Exception.php#139
Since:21.0.0

Methods

public OCP\DB\Exception::getReason()
Source:lib/public/DB/Exception.php#146
Returns:int | null
Since:21.0.0