Issue #18569 has been reported by Daniel Pittman. ---------------------------------------- Refactor #18569: Implement "whiny nil" for Puppet, solve `Undefined method `blah' for nil:NilClass` problem more elegantly https://projects.puppetlabs.com/issues/18569
Author: Daniel Pittman Status: Unreviewed Priority: Normal Assignee: Category: error reporting Target version: Affected Puppet version: Keywords: Branch: For years we have had a plague of "Undefined method `blah' for nil:NilClass" reports through Puppet. Every single one of those is a nasty bug: one of the prices of Ruby is that you have to hand-write all your type checking by hand, everywhere that matters, because there isn't a compiler or any type annotation to do that for you. Fun times. This leads to the nasty bug this describes, in which you end up missing a check somewhere in the system and (most often) end up with a NULL pointer dereference equivalent. Sure, Ruby saves you by turning that into a polite exception, but the net effect is still the same: welcome to the hell of random failures made worse by missing type checking. We should fix this. At the very least we should give more guidance about what went wrong, and what the user should do. We probably should make this serious internal bug report a stack trace and push the user to submit it to our system, all the time. (Optimally, we would have this push into some sort of automated system that can correlate these and rank them by priority, but that is getting fancy. ;) The obvious solution is something like `whiney_nil`, which adds some smarts to `NilClass` and `nil`: implement `method_missing` and report more helpful diagnostics based on the call chain, method, etc. Carefully ensure that `respond_to?` still returns `false` for all those things, though, so that people doing duck-typing get effective responses, and only blind calls trigger your code. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
