Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-05-03 06:15:00 +0400
committerisaacs <i@izs.me>2010-05-03 06:15:55 +0400
commit8f203371b94a9a3d9e9bb43fd6b9761bf67a9de3 (patch)
treea01acca8b4337c498b57c2f9aed64cfc5a55e01e /lib
parent47bd13383239a69472e84d5349dfe516c5c08883 (diff)
Don't throw when the data is null. Instead, just let the thing respond with the error
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/registry.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/registry.js b/lib/utils/registry.js
index 55b3470c2..0a6c6ffa4 100644
--- a/lib/utils/registry.js
+++ b/lib/utils/registry.js
@@ -92,7 +92,7 @@ function GET (where, cb) {
ex.message += "\n" + data
return cb(ex, data, response)
}
- if (data.error) return cb(new Error(
+ if (data && data.error) return cb(new Error(
data.error + (" "+data.reason || "")))
cb(null, data, response)
})
@@ -132,7 +132,7 @@ function PUT (where, what, cb) {
ex.message += "\n" + data
return cb(ex, data, response)
}
- if (data.error) return cb(new Error(
+ if (data && data.error) return cb(new Error(
data.error + (" "+data.reason || "")))
cb(null, data, response)
})