Bug in the rising of exception from proxy object #15

Closed
flipback opened this Issue Oct 29, 2011 · 6 comments

Comments

Projects
None yet
2 participants
@flipback
Collaborator

flipback commented Oct 29, 2011

This code is not valid.

require "rmodbus"

s = ModBus::TCPServer.new(9999, 1)
s.holding_registers = [1] * 10
s.start

ModBus::TCPClient.connect('127.0.0.1',9999) do |cl|
  cl.with_slave(1) do |slave|
      slave.holding_registers[0..2] = [0,0]
  end
end

s.stop

But it has raised unexpected exception instead of ModBus::Errors::ProxyException

/home/flipback/.rvm/gems/ruby-1.9.2-p290/gems/rmodbus-1.1.0/lib/rmodbus/proxy.rb:44:in `[]=': uninitialized constant ModBus::ReadWriteProxy::ProxyException (NameError)
    from test_rmd.rb:13:in `block (2 levels) in <main>'
    from /home/flipback/.rvm/gems/ruby-1.9.2-p290/gems/rmodbus-1.1.0/lib/rmodbus/client.rb:66:in `with_slave'
    from test_rmd.rb:8:in `block in <main>'
    from /home/flipback/.rvm/gems/ruby-1.9.2-p290/gems/rmodbus-1.1.0/lib/rmodbus/client.rb:39:in `initialize'
    from test_rmd.rb:7:in `new'
    from test_rmd.rb:7:in `<main>'
@kreynolds

This comment has been minimized.

Show comment Hide comment
@kreynolds

kreynolds Nov 7, 2011

Collaborator

Don't you mean [0..1]? You are attempting to assign two values to 3 registers

Collaborator

kreynolds commented Nov 7, 2011

Don't you mean [0..1]? You are attempting to assign two values to 3 registers

@flipback

This comment has been minimized.

Show comment Hide comment
@flipback

flipback Nov 7, 2011

Collaborator

Yes, you right! But exception is raised wrong. We should have ModBus::Errors::ProxyException. I know where problem. But I reported it becouse I don't want fix it now

Collaborator

flipback commented Nov 7, 2011

Yes, you right! But exception is raised wrong. We should have ModBus::Errors::ProxyException. I know where problem. But I reported it becouse I don't want fix it now

@kreynolds

This comment has been minimized.

Show comment Hide comment
@kreynolds

kreynolds Nov 7, 2011

Collaborator

Oh I see .. misunderstood. Will fix it shortly.

Collaborator

kreynolds commented Nov 7, 2011

Oh I see .. misunderstood. Will fix it shortly.

@ghost ghost assigned kreynolds Nov 7, 2011

@flipback

This comment has been minimized.

Show comment Hide comment
@flipback

flipback Nov 7, 2011

Collaborator

Ok =)

Collaborator

flipback commented Nov 7, 2011

Ok =)

@kreynolds

This comment has been minimized.

Show comment Hide comment
@kreynolds

kreynolds Nov 7, 2011

Collaborator

I couldn't actually reproduce this error because ProxyException is in my namespace, but I changed it to raise it explicitly anyway and added a spec for it and it passes. If you can still recreate it in some other environment, let me know.

Collaborator

kreynolds commented Nov 7, 2011

I couldn't actually reproduce this error because ProxyException is in my namespace, but I changed it to raise it explicitly anyway and added a spec for it and it passes. If you can still recreate it in some other environment, let me know.

@kreynolds kreynolds closed this Nov 7, 2011

@flipback

This comment has been minimized.

Show comment Hide comment
@flipback

flipback Nov 7, 2011

Collaborator

Good! But I have made a mess in branches of git(

Collaborator

flipback commented Nov 7, 2011

Good! But I have made a mess in branches of git(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment