undefined method `log_connection_exception' #22

Open
ledowong opened this Issue Jan 20, 2011 · 6 comments

Comments

Projects
None yet
5 participants

using 0.4.2 gem

try to deliver a notification to apple, but failed, with this error:

undefined method log_connection_exception' for #<Class:0x6cfbee8> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1994 :inmethod_missing_without_paginate'
C:/Users/Leonardo Wong/workspace/projectA/vendor/plugins/will_paginate/lib/will_
paginate/finder.rb:170:in method_missing' c:/ruby/lib/ruby/gems/1.8/gems/apn_on_rails-0.4.2/lib/apn_on_rails/app/models/ap n/app.rb:58:insend_notifications_for_cert'
c:/ruby/lib/ruby/gems/1.8/gems/apn_on_rails-0.4.2/lib/apn_on_rails/app/models/ap
n/app.rb:26:in send_notifications' c:/ruby/lib/ruby/gems/1.8/gems/apn_on_rails-0.4.2/lib/apn_on_rails/app/models/ap n/app.rb:32:insend_notifications'
c:/ruby/lib/ruby/gems/1.8/gems/apn_on_rails-0.4.2/lib/apn_on_rails/app/models/ap
n/app.rb:31:in each' c:/ruby/lib/ruby/gems/1.8/gems/apn_on_rails-0.4.2/lib/apn_on_rails/app/models/ap n/app.rb:31:insend_notifications'
c:/ruby/lib/ruby/gems/1.8/gems/apn_on_rails-0.4.2/lib/apn_on_rails/tasks/apn.rak
e:7
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_c hain' c:/ruby/lib/ruby/1.8/monitor.rb:242:insynchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exceptio n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 c:/ruby/bin/rake:19:inload'
c:/ruby/bin/rake:19

In app.rb, i comment line 58, and put "puts e.message" there, it shows:
259 out of char range

I know my message(alert) is too long, I will fix that, just try to report the code error here.

Thanks for this nice plugin. Save me a lot of time.

Member

rebeccanesson commented Jan 20, 2011

Hi,

We set up the log_connection_exception method as a method that you can define yourself to do your error reporting. I thought we had put an empty implementation in place, but perhaps not.

In any case, the change you made to log the error you were receiving was the sort of thing we imagined people might put in the log_connection_exception method anyway.

I'm glad you're finding the plugin useful.

I think that method should be a class method where it's defined, so that it does nothing by default (instead of erroring by default) - and people can then override the class method if they need to log something. Right now it's an instance method on the app class, but it's called from a class method.

Member

rebeccanesson commented Jan 20, 2011

Good suggestion. Thanks.

vinodc commented Feb 15, 2011

Submitted a pull request changing it to a class method, since I encountered this same issue. ( #27 )

I encountered this today (Jan 30th 2012)

vinodc commented Jan 31, 2012

@durrantm #27 was merged in today. The latest version should not result in this issue and the exception should be raised properly.

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