# LocalJumpError

**URL:** <https://www.ruby-forum.com/t/localjumperror/100040>\
**Category:** Ruby\
**Created:** [December 13, 2005, 1:01pm UTC](https://www.ruby-forum.com/t/localjumperror/100040 "2005-12-13T13:01:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [December 13, 2005, 1:01pm UTC](https://www.ruby-forum.com/t/localjumperror/100040/1 "2005-12-13T13:01:16Z")

</div>

Hi,

Because ruby-libexif no longer works with libexif-0.6.12, I decided to  
roll  
my own Exif class.  
Quick and dirty.  
And got a surprising error message.

Here’s the program:  
#!/usr/bin/ruby

#require ‘exif’

class Exif \< Hash  
@@want = %w{ DateTimeOriginal DateTime ImageDescription  
PixelYDimension }  
def initialize(file)

```
IO.popen("exiv2 -pt '#{file}'") do |h|
  h.each do |line|
    a = line.split[0].split(/\./)[2].strip
    if @@want.include?(a)
      self[a] = line[60 .. -1].strip
    end
  end
end

```

end  
end

def run  
exif = Exif.new(’/var/pictures/alpujaras/img\_0528\_edited.jpg’)  
puts exif[‘DateTimeOriginal’]  
exif = Exif.new(’/bin/ls’)  
puts exif[‘DateTimeOriginal’]  
next if exif.empty?  
puts “won’t get here”  
end

run

### End-of-ruby-program

If I run this, I get:  
2005:01:04 13:22:48  
Exiv2 exception in print action for file /bin/ls:  
/bin/ls: The file contains data of an unknown image type  
nil  
./add\_captions.rb:25:in `run’: unexpected next (LocalJumpError)  
from ./add\_captions.rb:29

For a real JPEG it works fine, but things get ugly otherwise:

I can’t quite figure out what this means.

Cheers,

Han H.

---

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [December 13, 2005, 1:10pm UTC](https://www.ruby-forum.com/t/localjumperror/100040/2 "2005-12-13T13:10:17Z")

</div>

Please cancel this.
