@@ -37,7 +37,7 @@ impl Save {
37
37
init_meta_table ( & db, & defaults) ?;
38
38
defaults
39
39
}
40
- Err ( e) => return Err ( OpenError :: Db ( DbError ( e. into ( ) ) ) ) ,
40
+ Err ( e) => return Err ( OpenError :: Db ( DbError ( Box :: new ( e. into ( ) ) ) ) ) ,
41
41
}
42
42
} ;
43
43
Ok ( Self { meta, db } )
@@ -65,8 +65,8 @@ impl Save {
65
65
}
66
66
}
67
67
68
- fn init_meta_table ( db : & Database , value : & Meta ) -> Result < ( ) , redb :: Error > {
69
- let tx = db. begin_write ( ) ?;
68
+ fn init_meta_table ( db : & Database , value : & Meta ) -> Result < ( ) , DbError > {
69
+ let tx = db. begin_write ( ) . map_err ( redb :: Error :: from ) ?;
70
70
let mut meta = tx. open_table ( META_TABLE ) ?;
71
71
let mut cctx = cctx ( ) ;
72
72
let mut plain = Vec :: new ( ) ;
@@ -281,7 +281,7 @@ pub enum OpenError {
281
281
282
282
impl From < redb:: Error > for OpenError {
283
283
fn from ( x : redb:: Error ) -> Self {
284
- OpenError :: Db ( DbError ( x ) )
284
+ OpenError :: Db ( DbError ( Box :: new ( x ) ) )
285
285
}
286
286
}
287
287
@@ -297,34 +297,40 @@ pub enum GetError {
297
297
298
298
impl From < redb:: Error > for GetError {
299
299
fn from ( x : redb:: Error ) -> Self {
300
- GetError :: Db ( DbError ( x ) )
300
+ GetError :: Db ( DbError ( Box :: new ( x ) ) )
301
301
}
302
302
}
303
303
304
304
impl From < redb:: StorageError > for GetError {
305
305
fn from ( x : redb:: StorageError ) -> Self {
306
- GetError :: Db ( DbError ( x. into ( ) ) )
306
+ GetError :: Db ( DbError ( Box :: new ( x. into ( ) ) ) )
307
307
}
308
308
}
309
309
310
310
#[ derive( Debug , Error ) ]
311
311
#[ error( transparent) ]
312
- pub struct DbError ( #[ from] redb:: Error ) ;
312
+ pub struct DbError ( Box < redb:: Error > ) ;
313
+
314
+ impl From < redb:: Error > for DbError {
315
+ fn from ( x : redb:: Error ) -> Self {
316
+ DbError ( Box :: new ( x) )
317
+ }
318
+ }
313
319
314
320
impl From < redb:: StorageError > for DbError {
315
321
fn from ( x : redb:: StorageError ) -> Self {
316
- DbError ( x. into ( ) )
322
+ DbError ( Box :: new ( x. into ( ) ) )
317
323
}
318
324
}
319
325
320
326
impl From < redb:: CommitError > for DbError {
321
327
fn from ( x : redb:: CommitError ) -> Self {
322
- DbError ( x. into ( ) )
328
+ DbError ( Box :: new ( x. into ( ) ) )
323
329
}
324
330
}
325
331
326
332
impl From < redb:: TableError > for DbError {
327
333
fn from ( x : redb:: TableError ) -> Self {
328
- DbError ( x. into ( ) )
334
+ DbError ( Box :: new ( x. into ( ) ) )
329
335
}
330
336
}
0 commit comments