Update Database.logError documentation, and make it clear that it has to be called very very early.

This commit is contained in:
Gwendal Roué committed 2017-12-07 13:35:19 +01:00
1 parent 5b7f4a7ff5
commit f356f8734a
1 file changed
+3 -1
+3 -1
View File
@@ -5466,7 +5466,7 @@ See [prepared statements](#prepared-statements) and [DatabaseValue](#databaseval
**SQLite can be configured to invoke a callback function containing an error code and a terse error message whenever anomalies occur.**
It is recommended that you setup, early in the lifetime of your application, the error logging callback:
This global error callback must be configured early in the lifetime of your application:
```swift
Database.logError = { (resultCode, message) in
@@ -5474,6 +5474,8 @@ Database.logError = { (resultCode, message) in
}
```
> :warning: **Warning**: Database.logError must be set before any database connection is opened. This includes the connections that your application opens with GRDB, but also connections opened by other tools, such as third-party libraries. Setting it after a connection has been opened is an SQLite misuse, and has no effect.
See [The Error And Warning Log](https://sqlite.org/errlog.html) for more information.