Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
util-superagent-serializer
Advanced tools
process superagent response to get better error logging result
process superagent response to get better error logging result
const request = require('superagent');
const serial = require('util-superagent-serializer');
superagent.get(restful_url)
.end((err, res)=>{
// superagent will detect general http level error for you(404, 403, 500...)
if (err) return console.error(err);
// Golden Rule: in javascript, you should trust your own input
// But, you should NEVER trust 3rd party input. `res` is 3rd party input
if (!isSomething(res)) return console.error(NotSomethingErr(res));
// Now, you can trust the res, and continue your codes
....
});
function isSomething(res) {
// check if the res is something you want here
}
function NotSomethingErr(res) {
var err = new TypeError('we got something unknown');
// serialize the res, and log the error, so we know what happened.
err.original = serial(res);
return err;
}
FAQs
process superagent response to get better error logging result
The npm package util-superagent-serializer receives a total of 1 weekly downloads. As such, util-superagent-serializer popularity was classified as not popular.
We found that util-superagent-serializer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.