Closed noozo closed 10 years ago
Do you have a stack trace?
Was just about to reply to myself. It happens when the creditor_identifier is invalid. Can you handle it more gracefully? :)
It would be very helpful to get the stack trace or at least the line number of the failing code. Additionally, please tell me an example creditor_identifier which raises this exception. Better would be a failing test, best is creating a pull request ;-)
You're right :)
If you use nil it believe it will throw this. Didn't try with empty string or a non-valid string.
Here's the stack:
sepa_king (0.1.0) lib/sepa_king/validator.rb:31:in valid?' sepa_king (0.1.0) lib/sepa_king/validator.rb:23:in
validate'
activesupport (3.2.14) lib/active_support/callbacks.rb:310:in _callback_before_7' activesupport (3.2.14) lib/active_support/callbacks.rb:440:in
_run313393702109351557validate4199759393947241247callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.14) lib/active_support/callbacks.rb:385:in
_run_validate_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in run_callbacks' activemodel (3.2.14) lib/active_model/validations.rb:228:in
run_validations!'
activemodel (3.2.14) lib/active_model/validations.rb:195:in valid?' sepa_king (0.1.0) lib/sepa_king/message.rb:16:in
block in class:Message'
activesupport (3.2.14) lib/active_support/callbacks.rb:418:in _run__682144103491543913__validate__4199759393947241247__callbacks' activesupport (3.2.14) lib/active_support/callbacks.rb:405:in
__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in _run_validate_callbacks' activesupport (3.2.14) lib/active_support/callbacks.rb:81:in
run_callbacks'
activemodel (3.2.14) lib/active_model/validations.rb:228:in run_validations!' activemodel (3.2.14) lib/active_model/validations.rb:195:in
valid?'
sepa_king (0.1.0) lib/sepa_king/message.rb:34:in to_xml' app/models/cobranca.rb:129:in
gerar_ficheiro_sepa'
I see you are using v0.1.0. Please try the lastet code from the repo, which contains some unreleased features regarding validations.
Cool. Though keep in mind that most people will probably use the gem, so you might want to release another one ;)
Sure, next release will be published in the very near future. Is your issue fixed with the latest code?
Can't try it right now, as i'm working in another project. But as soon as i can i'll update you. Thanks.
Happens when generating the xml, i.e.: sdd.to_xml
Any idea what might be causing it?