Misleading error message doesn't hint on how to fix the problem #30

Merged
merged 1 commit into from Apr 29, 2011

Projects

None yet

2 participants

@francois
Contributor

I thought this message was misleading. My real error was I had never called Sequel#connect, not that the database server was absent, unreachable or that the database doesn't exist. Actually, when I read the message the first time I started digging in my PostgreSQL instance to ensure the database and tables existed.

I can't find a spec that checks for that error. I actually removed the spec, and no specs failed. I don't see how this could be spec'd either.

Reproduction recipe:

require "rubygems"
require "sequel"
require "jdbc/postgres"  
class A < Sequel::Model(:a); end
Sequel::Error: No database associated with Sequel::Model
    from /Users/francois/.rvm/gems/jruby-1.6.0/gems/sequel-3.22.0/lib/sequel/model/base.rb:165:in `db'
    from /Users/francois/.rvm/gems/jruby-1.6.0/gems/sequel-3.22.0/lib/sequel/model/base.rb:271:in `inherited'
    from /Users/francois/.rvm/gems/jruby-1.6.0/gems/sequel-3.22.0/lib/sequel/model/associations.rb:696:in `inherited'
    from org/jruby/RubyClass.java:837:in `initialize'
    from /Users/francois/.rvm/gems/jruby-1.6.0/gems/sequel-3.22.0/lib/sequel/model.rb:43:in `Model'
    from (irb):5:in `evaluate'
    from org/jruby/RubyKernel.java:1087:in `eval'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/lib/ruby/1.8/irb.rb:158:in `eval_input'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/lib/ruby/1.8/irb.rb:271:in `signal_status'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/lib/ruby/1.8/irb.rb:155:in `eval_input'
    from org/jruby/RubyKernel.java:1417:in `loop'
    from org/jruby/RubyKernel.java:1190:in `catch'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/lib/ruby/1.8/irb.rb:154:in `eval_input'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/lib/ruby/1.8/irb.rb:71:in `start'
    from org/jruby/RubyKernel.java:1190:in `catch'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/lib/ruby/1.8/irb.rb:70:in `start'
    from /Users/francois/.rvm/rubies/jruby-1.6.0/bin/irb:17:in `(root)'
@jeremyevans
Owner

I don't think the error message is currently misleading, but you are right that it doesn't hint on how to fix the problem. I've merged the commit into my local repo and will push the changes up later today.

@jeremyevans jeremyevans merged commit f87103a into jeremyevans:master Apr 29, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment