Skip to content

Instantly share code, notes, and snippets.

@felixge
Forked from ry/fab-promise.js
Created January 27, 2010 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixge/287401 to your computer and use it in GitHub Desktop.
Save felixge/287401 to your computer and use it in GitHub Desktop.
function loadConfig() {
return posix.cat('config.json')(function(error, config) {
return error || posix.cat('configuration.json')
})(function(error, config) {
return error || JSON.parse(config);
})
}
function loadConfig() {
return posix.cat('config.json')
.addErrback(function(err) {
return posix.cat('configuration.json');
})
.addCallback(function(config) {
return JSON.parse(config);
})
.addErrback(function(err) {
throw new Error("Can't load config");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment