# Ruby exception occured \`+'

**URL:** https://discuss.elastic.co/t/ruby-exception-occured/90192
**Category:** Logstash
**Created:** [June 21, 2017, 4:07am UTC](https://discuss.elastic.co/t/ruby-exception-occured/90192 "2017-06-21T04:07:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Xavier\_Clavien](https://avatars.discourse-cdn.com/v4/letter/x/57b2e6/32.png) [@Xavier\_Clavien](https://discuss.elastic.co/u/Xavier_Clavien)
#### Post date: [June 21, 2017, 4:07am UTC](https://discuss.elastic.co/t/ruby-exception-occured/90192/1 "2017-06-21T04:07:16Z")

</div>

Hi guys

Got strange exception because the result is correct, but then all the code after the one who caused the exception is not working anymore. Here is the code :

> event.set( '[ln\_resistance\_B\_inversion]', ( event.get('[ln\_payload\_decoded]')[72..73] + event.get('[ln\_payload\_decoded]')[70..71] ) )  
> event.set( '[ln\_resistance]', [event.get('[ln\_resistance\_B\_inversion]')].pack('H\*').unpack('g').first )  
> event.set( '[ln\_temperature\_B\_inversion]', ( event.get('[ln\_payload\_decoded]')[52..53] + event.get('[ln\_payload\_decoded]')[50..51] ) )  
> event.set( '[ln\_temperature]', [event.get('[ln\_temperature\_B\_inversion]')].pack('H\*').unpack('g').first )

Then the error that I have is the following :

> exception occurred: undefined method `+' for nil:NilClass

I have the correct value for **ln\_resistance\_B\_inversion** and **ln\_resistance** but not for the others after

Thanks in advanced

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [June 21, 2017, 5:33am UTC](https://discuss.elastic.co/t/ruby-exception-occured/90192/2 "2017-06-21T05:33:37Z")

</div>

Show an example of an event that results in this error. Use a `stdout { codec => rubydebug }` output.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 19, 2017, 5:33am UTC](https://discuss.elastic.co/t/ruby-exception-occured/90192/3 "2017-07-19T05:33:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
