Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit cd990dd

Browse files
authored
fix: add errors for get and has failed (#71)
For when getting/hasing a block fails, rather than when it wasn't found
1 parent 234b835 commit cd990dd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/errors.ts

+10
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ export function putFailedError (err?: Error): Error {
1515
return errCode(err, 'ERR_PUT_FAILED')
1616
}
1717

18+
export function getFailedError (err?: Error): Error {
19+
err = err ?? new Error('Get failed')
20+
return errCode(err, 'ERR_GET_FAILED')
21+
}
22+
1823
export function deleteFailedError (err?: Error): Error {
1924
err = err ?? new Error('Delete failed')
2025
return errCode(err, 'ERR_DELETE_FAILED')
2126
}
2227

28+
export function hasFailedError (err?: Error): Error {
29+
err = err ?? new Error('Has failed')
30+
return errCode(err, 'ERR_HAS_FAILED')
31+
}
32+
2333
export function notFoundError (err?: Error): Error {
2434
err = err ?? new Error('Not Found')
2535
return errCode(err, 'ERR_NOT_FOUND')

0 commit comments

Comments
 (0)