initialization: better error handling for a YAML file that is missing the required namespace section #14

1 commit merged into from Jun 6, 2011


None yet

1 participant


We've been bitten by this a couple of times. We've got a different YAML file per environment and the config blocks in the files are namespaced accordingly with "development", "production", etc. If we happen to accidentally pass the development YAML file to the production app, it will open up the YAML file and attempt to find a "production" section that isn't there. Then instead of letting us know what the actual problem is (can't find a "production" section in the YAML file), the initialize() method ignores the fact that the section was missing and proceeds to attempt "self.replace hash" with "hash" being nil.

This tiny update to initialize() will trap for the condition of the missing namespace section and raise an informative exception instead of the somewhat less helpful "can't convert nil into Hash" one we're seeing now.

@fallwith fallwith during initialization, raise an error that indicates that the namespa…
…ce in question is not defined in the YAML file rather than ending up with a nil object that we try to replace self with
@ghost ghost merged commit 4519763 into binarylogic:master Jun 6, 2011
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment