Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be possible to change Robe errors buffer from inf-ruby buffer to another buffer #143

Open
anquegi opened this issue Jan 13, 2023 · 2 comments

Comments

@anquegi
Copy link

anquegi commented Jan 13, 2023

Thanks for this great package, This is not a bug, maybe is a question about usability in conjunction with inf-ruby package
I'm using robe with my project rails, and i also use the Pry console as a REPL for development, but I get a lot of annoying traces when using robe in rails buffer (inf-ruby comint buffer):

E, [2023-01-13T10:37:25.534518 #19192] ERROR -- : Request failed: /method_targets/_id/bill_user/CreateImportedBillLib/-/-/yes. Please file an issue.
E, [2023-01-13T10:37:25.535610 #19192] ERROR -- : undefined method `has_key?' for nil:NilClass
/home/toni/src/company_name/P-bills/bills/.direnv/ruby/gems/whenever-1.0.0/lib/whenever/job_list.rb:41:in `respond_to?'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:29:in `block in maybe_scan'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:28:in `each_object'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:28:in `maybe_scan'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:7:in `method_owner_and_inst'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:58:in `method_spec'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:107:in `block in method_targets'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:107:in `map'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:107:in `method_targets'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:182:in `public_send'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:182:in `call'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/server.rb:45:in `block in start'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/server.rb:29:in `loop'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/server.rb:29:in `start'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe.rb:30:in `block in start'
E, [2023-01-13T10:41:04.498257 #19192] ERROR -- : Request failed: /method_targets/_id/bill_user/CreateImportedBillLib/-/-/yes. Please file an issue.
E, [2023-01-13T10:41:04.499314 #19192] ERROR -- : undefined method `has_key?' for nil:NilClass
/home/toni/src/company_name/P-bills/bills/.direnv/ruby/gems/whenever-1.0.0/lib/whenever/job_list.rb:41:in `respond_to?'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:29:in `block in maybe_scan'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:28:in `each_object'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:28:in `maybe_scan'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash/includes_tracker.rb:7:in `method_owner_and_inst'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:58:in `method_spec'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:107:in `block in method_targets'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:107:in `map'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:107:in `method_targets'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:182:in `public_send'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/sash.rb:182:in `call'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/server.rb:45:in `block in start'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/server.rb:29:in `loop'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe/server.rb:29:in `start'
/home/toni/.doom-emacs/.local/straight/build-29.0.60/robe/lib/robe.rb:30:in `block in start'
[171] pry(CreateImportedBillLib):1> 
@dgutov
Copy link
Owner

dgutov commented Jan 23, 2023

Hi!

I can add an option to write this to a file. But the foremost reason to have this logger to stderr is that a command execution failed, which means there is a bug in some package/gem (this or a different one) which stops a certain function of this package from working.

Looking at the log, it seems the navigation to the method bill_user has failed (twice). And the reason for it is that the whenever gem has its JobList class override the self.respond_to? method in a fashion incompatible with Object#respond_to? (violating the Liskov principle). It does seem like this method is unused by the gem itself, so I suggest to:

  • File a bug report about it,
  • Add this to .robe inside the project root, and restart Robe:
require 'whenever/job_list'

module Whenever
  class JobList
    class << self
      remove_method :respond_to?
    end
  end
end

(Code untested, let me know if it doesn't work).

@dgutov
Copy link
Owner

dgutov commented Jan 23, 2023

To sum up, it's usually better to try to fix the errors rather than ignore them.

I've pushed an option to redirect the error logging to a file, though. See the branch error_logdev. Let me know if it works for you, and you still think it's a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants