@@ -6,6 +6,7 @@ const many = require('pull-many')
6
6
const pull = require ( 'pull-stream' )
7
7
8
8
const Key = require ( 'interface-datastore' ) . Key
9
+ const Errors = require ( 'interface-datastore' ) . Errors
9
10
const utils = require ( 'interface-datastore' ) . utils
10
11
const asyncFilter = utils . asyncFilter
11
12
const asyncSort = utils . asyncSort
@@ -62,8 +63,9 @@ class MountDatastore /* :: <Value> */ {
62
63
put ( key /* : Key */ , value /* : Value */ , callback /* : Callback<void> */ ) /* : void */ {
63
64
const match = this . _lookup ( key )
64
65
if ( match == null ) {
65
- callback ( new Error ( 'No datastore mounted for this key' ) )
66
- return
66
+ return callback (
67
+ Errors . dbWriteFailedError ( new Error ( 'No datastore mounted for this key' ) )
68
+ )
67
69
}
68
70
69
71
match . datastore . put ( match . rest , value , callback )
@@ -72,8 +74,9 @@ class MountDatastore /* :: <Value> */ {
72
74
get ( key /* : Key */ , callback /* : Callback<Value> */ ) /* : void */ {
73
75
const match = this . _lookup ( key )
74
76
if ( match == null ) {
75
- callback ( new Error ( 'No datastore mounted for this key' ) )
76
- return
77
+ return callback (
78
+ Errors . notFoundError ( new Error ( 'No datastore mounted for this key' ) )
79
+ )
77
80
}
78
81
79
82
match . datastore . get ( match . rest , callback )
@@ -92,8 +95,9 @@ class MountDatastore /* :: <Value> */ {
92
95
delete ( key /* : Key */ , callback /* : Callback<void> */ ) /* : void */ {
93
96
const match = this . _lookup ( key )
94
97
if ( match == null ) {
95
- callback ( new Error ( 'No datastore mounted for this key' ) )
96
- return
98
+ return callback (
99
+ Errors . dbDeleteFailedError ( new Error ( 'No datastore mounted for this key' ) )
100
+ )
97
101
}
98
102
99
103
match . datastore . delete ( match . rest , callback )
0 commit comments