wcdb
wcdb copied to clipboard
Error handling
The language of WCDB
Objective-C WCDB.objc
The version of WCDB
2.1.0
The platform of WCDB
iOS
The installation of WCDB
Cocoapods
What's the issue?
- The database table has a unique constraint set.
[database traceError:^(WCTError *_Nonnull error) {
NSString *message = error.message;
WCTErrorExtendedCode extendedCode = [error extendedCode];
/*
* The callback here will be triggered first, and extendedCode is WCTErrorExtendedCodeConstraintUnique.
*/
}];
// Simulate unique constraint data insertion here
[database insertObject:object intoTable:xx];
WCTError *error = [database error];
/*
* But the extendedCode obtained here is not WCTErrorExtendedCodeConstraintUnique.
* And this error is also isOk
*/
WCTErrorExtendedCode extendedCode = [error extendedCode];
Get
You can use insertOrIgnore or insertOrReplace here.
You can use insertOrIgnore or insertOrReplace here.
- I know this can be solved
- But this error itself should be a bug
Fixed in v2.1.4