Skip to content

Instantly share code, notes, and snippets.

@felixge
Created January 26, 2010 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save felixge/287381 to your computer and use it in GitHub Desktop.
Save felixge/287381 to your computer and use it in GitHub Desktop.
function loadConfig() {
return posix
.cat('config.json')
(true, function(config) {
return (config instanceof Error)
? posix.cat('configuration.json')
: config;
})
(function() {
return 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