File tree 5 files changed +20
-4
lines changed
5 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 11
11
* Generator not longer warns that it can not find the package source root if the output directory is
12
12
the package root directory.
13
13
* Add ` StorageException ` which is a ` ObjectBoxException ` with an ` errorCode ` (a ` OBX_ERROR ` code).
14
+ * Throw ` DbFullException ` instead of ` ObjectBoxException ` with message ` 10101 Could not put ` (error
15
+ code ` OBX_ERROR_DB_FULL ` ).
14
16
15
17
## 1.6.2 (2022-08-24)
16
18
Original file line number Diff line number Diff line change
1
+ import '../objectbox.dart' ;
2
+
1
3
/// Wrapper for a semantic version information.
2
4
class Version {
3
5
/// Major version number.
@@ -40,6 +42,13 @@ class StorageException extends ObjectBoxException {
40
42
String toString () => 'StorageException: $message (OBX_ERROR code $errorCode )' ;
41
43
}
42
44
45
+ /// Thrown when applying a transaction (e.g. putting an object) would exceed the
46
+ /// `maxDBSizeInKB` configured when calling [Store.new] .
47
+ class DbFullException extends StorageException {
48
+ /// See [DbFullException] .
49
+ DbFullException (String message, int errorCode) : super (message, errorCode);
50
+ }
51
+
43
52
/// A unique constraint would have been violated by this database operation.
44
53
class UniqueViolationException extends ObjectBoxException {
45
54
/// Create a new exception.
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ class ObjectBoxNativeError {
78
78
throw RangeError (messageWithErrorCode);
79
79
case OBX_ERROR_UNIQUE_VIOLATED :
80
80
throw UniqueViolationException (messageWithContext);
81
+ case OBX_ERROR_DB_FULL :
82
+ throw DbFullException (messageWithContext, code);
81
83
default :
82
84
if (code == 0 ) {
83
85
throw ObjectBoxException (messageWithContext);
Original file line number Diff line number Diff line change @@ -98,13 +98,16 @@ class Store {
98
98
/// ## Maximum database size
99
99
///
100
100
/// [maxDBSizeInKB] sets the maximum size the database file can grow to.
101
- /// By default this is 1 GB, which should be sufficient for most applications.
102
- /// The store will throw when trying to insert more data if the maximum size
103
- /// is reached.
101
+ /// When applying a transaction (e.g. putting an object) would exceed it a
102
+ /// [DbFullException] is thrown.
104
103
///
104
+ /// By default, this is 1 GB, which should be sufficient for most applications.
105
105
/// In general, a maximum size prevents the database from growing indefinitely
106
106
/// when something goes wrong (for example data is put in an infinite loop).
107
107
///
108
+ /// This value can be changed, so increased or also decreased, each time when
109
+ /// opening a store.
110
+ ///
108
111
/// ## File mode
109
112
///
110
113
/// Specify [unix-style file permissions] (https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation)
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ void main() {
248
248
expect (
249
249
() => box.put (testEntity2),
250
250
throwsA (predicate ((e) =>
251
- e is StorageException &&
251
+ e is DbFullException &&
252
252
e.errorCode == OBX_ERROR_DB_FULL &&
253
253
e.message == 'object put failed: Could not put' )));
254
254
You can’t perform that action at this time.
0 commit comments