Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace explain-error with clarify-error #21

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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