Sha256: 78390048a0cd2c1cbd5ef1ad901e927fafd6cb3b4fe301a2a49c3eb71f0094c1

Contents?: true

Size: 795 Bytes

Versions: 32

Compression:

Stored size: 795 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)
			/* Annotate the "checkFile" error. */
			return (callback(new verror.VError(
			    err, 'request failed')));

		/* ... */
		return (callback());
	});
}

handleRequest('/nonexistent', function (err) {
	if (err) {
		console.log(err.message);
		console.log(extsprintf.sprintf('%r', err));
	}

    /* ... */
});

Version data entries

32 entries across 27 versions & 7 rubygems

Version Path
affiliator-0.2.1 node_modules/fsevents/node_modules/verror/examples/levels-verror.js
lanes-0.8.0 node_modules/verror/examples/levels-verror.js
lanes-0.8.0 node_modules/fsevents/node_modules/verror/examples/levels-verror.js
node-compiler-0.9.1 vendor/node/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
node-compiler-0.9.0 vendor/node-v7.2.1/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
select_all-rails-0.3.1 node_modules/verror/examples/levels-verror.js
node-compiler-0.8.0 vendor/node-v7.2.0/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
node-compiler-0.7.0 vendor/node-v7.1.0/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
node-compiler-0.7.0 vendor/node-v6.9.1/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.10 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.9 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.8 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.7 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.6 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.5 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.4 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.3 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.2 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.1 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js