Skip to content

Commit

Permalink
replace explain-error with clarify-error
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Mar 2, 2022
1 parent caf8f0e commit e0d6b8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cont = require('cont')
var pull = require('pull-stream')
var defer = require('pull-defer')
var path = require('path')
var explain = require('explain-error')
var clarify = require('clarify-error')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var fs = require('fs')
Expand Down Expand Up @@ -136,7 +136,7 @@ module.exports = function Blobs (config) {
var stream = defer.source()
stat(toPath(dir, id), function (err, stat) {
if(err)
stream.abort(explain(err, 'stat failed'))
stream.abort(clarify(err, 'stat failed'))

else if(opts.size != null && opts.size !== stat.size)
stream.abort(new Error('incorrect file length,'
Expand Down Expand Up @@ -207,7 +207,7 @@ module.exports = function Blobs (config) {
if('function' === typeof id) cb = id, id = null

if(!cb) cb = function (err) {
if(err) throw explain(err, 'no callback provided')
if(err) throw clarify(err, 'no callback provided')
}

if(id && !isHash(id)) {
Expand All @@ -232,7 +232,7 @@ module.exports = function Blobs (config) {
return data
}),
Write(tmpfile, function (err) {
if(err) return cb(explain(err, 'could not write to tmpfile'))
if(err) return cb(clarify(err, 'could not write to tmpfile'))

var _id = encode(hasher.digest, alg)

Expand All @@ -244,7 +244,7 @@ module.exports = function Blobs (config) {

mkdirp(path.dirname(p)).then(function () {
fs.rename(tmpfile, p, function (err) {
if(err) cb(explain(err, 'could not move file'))
if(err) cb(clarify(err, 'could not move file'))
else newBlob({id:toHash(p), size: size, ts: Date.now()}), cb(null, _id)
})
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"blake2s": "^1.0.1",
"cont": "^1.0.1",
"explain-error": "^1.0.1",
"clarify-error": "^1.0.0",
"mkdirp": "^1.0.4",
"pull-catch": "^1.0.0",
"pull-defer": "^0.2.2",
Expand Down

0 comments on commit e0d6b8f

Please sign in to comment.