Sha256: b206f3c5cdee9eba8f97b4c5ae75acfaca39328893b3f81a7c605adbb4f958ca
Contents?: true
Size: 761 Bytes
Versions: 32
Compression:
Stored size: 761 Bytes
Contents
var extsprintf = require('extsprintf'); var fs = require('fs'); var verror = require('../lib/verror'); function checkFile(filename, callback) { fs.stat(filename, function (err) { if (err) /* Annotate the "stat" error with what we were doing. */ return (callback(new verror.VError(err, 'failed to check "%s"', filename))); /* ... */ return (callback()); }); } function handleRequest(filename, callback) { checkFile('/nonexistent', function (err) { if (err) /* Wrap the "checkFile" error. */ return (callback(new verror.WError( err, 'request failed'))); /* ... */ return (callback()); }); } handleRequest('/nonexistent', function (err) { if (err) { console.log(err.message); console.log(err.toString()); } });
Version data entries
32 entries across 27 versions & 7 rubygems