added an error handler to getConfig.