With exception error I wanted to mean handling exceptions, for instance, when you try to load music from a file that doesn't exist (same occurs with texture, and probably but not tested Sprites, Images, etc).
when trying:
texture = Texture.new('non_existent.jpg')
the konsole output is:
vivo@ubuntu:~/Escritorio/proyectoAG/primer_juego$ ruby juego.rb
juego.rb:19:in `initialize': Failed to load image "non_existent.jpg". Reason : Unable to open file (SFML::Error)
from juego.rb:19:in `new'
from juego.rb:19:in `<main>'
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server "xU
X�� "
after 119 requests (118 known processed) with 0 events remaining.
*** glibc detected *** ruby: free(): invalid pointer: 0x0a29d620 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6c0c1)[0x3f20c1]
/lib/libc.so.6(+0x6d930)[0x3f3930]
/lib/libc.so.6(cfree+0x6d)[0x3f6a1d]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x595441]
/usr/lib/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0x577acd]
/usr/lib/libstdc++.so.6(_ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev+0xe8)[0x5701d8]
/lib/libc.so.6(+0x2f69e)[0x3b569e]
/lib/libc.so.6(+0x2f70f)[0x3b570f]
/usr/lib/libX11.so.6(_XDefaultIOError+0xb0)[0x671bb0]
/usr/lib/libX11.so.6(_XIOError+0x56)[0x671c36]
/usr/lib/libX11.so.6(+0x41a8a)[0x679a8a]
/usr/lib/libX11.so.6(_XReply+0x106)[0x67a036]
/usr/lib/libX11.so.6(XQueryExtension+0xa2)[0x6673c2]
/usr/lib/libX11.so.6(XInitExtension+0x3b)[0x65b9bb]
/usr/lib/libXext.so.6(XextAddDisplay+0x4c)[0x76ec5c]
/usr/lib/fglrx/libGL.so.1(AtiCallFGLComposite+0x213)[0x872df9]
======= Memory map: ========
00110000-00338000 r-xp 00000000 07:00 1151702 /usr/local/lib/libruby.so.1.9.1
00338000-00339000 r--p 00227000 07:00 1151702 /usr/local/lib/libruby.so.1.9.1
00339000-0033a000 rw-p 00228000 07:00 1151702 /usr/local/lib/libruby.so.1.9.1
0033a000-00347000 rw-p 00000000 00:00 0
00347000-0034e000 r-xp 00000000 07:00 724171 /lib/librt-2.12.1.so
0034e000-0034f000 r--p 00006000 07:00 724171 /lib/librt-2.12.1.so
0034f000-00350000 rw-p 00007000 07:00 724171 /lib/librt-2.12.1.so
00350000-00352000 r-xp 00000000 07:00 724086 /lib/libdl-2.12.1.so
00352000-00353000 r--p 00001000 07:00 724086 /lib/libdl-2.12.1.so
00353000-00354000 rw-p 00002000 07:00 724086 /lib/libdl-2.12.1.so
00354000-0035d000 r-xp 00000000 07:00 724071 /lib/libcrypt-2.12.1.so
0035d000-0035e000 r--p 00008000 07:00 724071 /lib/libcrypt-2.12.1.so
0035e000-0035f000 rw-p 00009000 07:00 724071 /lib/libcrypt-2.12.1.so
0035f000-00386000 rw-p 00000000 00:00 0
00386000-004dd000 r-xp 00000000 07:00 724508 /lib/libc-2.12.1.so
004dd000-004df000 r--p 00157000 07:00 724508 /lib/libc-2.12.1.so
004df000-004e0000 rw-p 00159000 07:00 724508 /lib/libc-2.12.1.so
004e0000-004e3000 rw-p 00000000 00:00 0
004e3000-004e5000 r-xp 00000000 07:00 1135415 /usr/local/lib/ruby/1.9.1/i686-linux/enc/encdb.so
004e5000-004e6000 r--p 00001000 07:00 1135415 /usr/local/lib/ruby/1.9.1/i686-linux/enc/encdb.so
004e6000-004e7000 rw-p 00002000 07:00 1135415 /usr/local/lib/ruby/1.9.1/i686-linux/enc/encdb.so
004e7000-004e9000 r-xp 00000000 07:00 1135417 /usr/local/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
004e9000-004ea000 r--p 00001000 07:00 1135417 /usr/local/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
004ea000-004eb000 rw-p 00002000 07:00 1135417 /usr/local/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
004eb000-005ca000 r-xp 00000000 07:00 789602 /usr/lib/libstdc++.so.6.0.14
005ca000-005ce000 r--p 000de000 07:00 789602 /usr/lib/libstdc++.so.6.0.14
005ce000-005cf000 rw-p 000e2000 07:00 789602 /usr/lib/libstdc++.so.6.0.14
005cf000-005d6000 rw-p 00000000 00:00 0
005d6000-005dc000 r-xp 00000000 07:00 788783 /usr/lib/libXrandr.so.2.2.0
005dc000-005dd000 r--p 00005000 07:00 788783 /usr/lib/libXrandr.so.2.2.0
005dd000-005de000 rw-p 00006000 07:00 788783 /usr/lib/libXrandr.so.2.2.0
005de000-005df000 r-xp 00000000 07:00 1151037 /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/all.so
005df000-005e0000 r--p 00000000 07:00 1151037 /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/all.so
005e0000-005e1000 rw-p 00001000 07:00 1151037 /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/all.so
005e1000-005fb000 r-xp 00000000 07:00 654160 /lib/libgcc_s.so.1
005fb000-005fc000 r--p 00019000 07:00 654160 /lib/libgcc_s.so.1
005fc000-005fd000 rw-p 0001a000 07:00 654160 /lib/libgcc_s.so.1
005fd000-00606000 r-xp 00000000 07:00 1135353 /usr/local/lib/libsfml-system.so.2.0
00606000-00607000 r--p 00008000 07:00 1135353 /usr/local/lib/libsfml-system.so.2.0
00607000-00608000 rw-p 00009000 07:00 1135353 /usr/local/lib/libsfml-system.so.2.0
00608000-00620000 r-xp 00000000 07:00 1151035 /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/window.so
00620000-00621000 r--p 00017000 07:00 1151035 /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/window.so
00621000-00622000 rw-p 00018000 07:00 1151035 /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/window.so
00622000-00636000 r-xp 00000000 07:00 1135355 /usr/local/lib/libsfml-window.so.2.0
00636000-00637000 r--p 00013000 07:00 1135355 /usr/local/lib/libsfml-window.so.2.0
00637000-00638000 rw-p 00014000 07:00 1135355 /usr/local/lib/libsfml-window.so.2.0
00638000-00751000 r-xp 00000000 07:00 788746 /usr/lib/libX11.so.6.3.0
00751000-00752000 r--p 00118000 07:00 788746 /usr/lib/libX11.so.6.3.0
00752000-00754000 rw-p 00119000 07:00 788746 /usr/lib/libX11.so.6.3.0
00754000-00755000 rw-p 00000000 00:00 0
00755000-0075c000 r-xp 00000000 07:00 785634 /usr/lib/fglrx/libatiuki.so.1.0
0075c000-0075d000 rw-p 00006000 07:00 785634 /usr/lib/fglrx/libatiuki.so.1.0
0075d000-0075f000 r-xp 00000000 07:00 788750 /usr/lib/libXau.so.6.0.0
0075f000-00760000 r--p 00001000 07:00 788750 /usr/lib/libXau.so.6.0.0
00760000-00761000 rw-p 00002000 07:00 788750 /usr/lib/libXau.so.6.0.0
00762000-00770000 r-xp 00000000 07:00 788763 /usr/lib/libXext.so.6.4.0
00770000-00771000 r--p 0000d000 07:00 788763 /usr/lib/libXext.so.6.4.0
00771000-00772000 rw-p 0000e000 07:00 788763 /usr/lib/libXext.so.6.4.0
00772000-0077a000 r-xp 00000000 07:00 788785 /usr/lib/libXrender.so.1.3.0
0077a000-0077b000 r--p 00007000 07:00 788785 /usr/lib/libXrender.so.1.3.0
0077b000-0077c000 rw-p 00008000 07:00 788785 /usr/lib/libXrender.so.1.3.0
0077c000-007b1000 r-xp 00000000 07:00 848703 /usr/lib/libjpeg.so.8.0.2
007b1000-007b2000 r--p 00034000 07:00 848703 /usr/lib/libjpeg.so.8.0.2
007b2000-007b3000 rw-p 00035000 07:00 848703 /usr/lib/libjpeg.so.8.0.2
007b3000-007b6000 r-xp 00000000 07:00 662016 /lib/libuuid.so.1.3.0
007b6000-007b7000 r--p 00002000 07:00 662016 /lib/libuuid.so.1.3.0
007b7000-007b8000 rw-p 00003000 07:00 662016 /lib/libuuid.so.1.3.0
007bb000-007d7000 r-xp 00000000 07:00 724038 /lib/ld-2.12.1.so
007d7000-007d8000 r--p 0001b000 07:00 724038 /lib/ld-2.12.1.so
007d8000-007d9000 rw-p 0001c000 07:00 724038 /lib/ld-2.12.1.so
007d9000-007e0000 r-xp 00000000 07:00 788742 /usr/lib/libSM.so.6.0.1
007e0000-007e1000 r--p 00006000 07:00 788742 /usr/lib/libSM.so.6.0.1
007e1000-007e2000 rw-p 00007000 07:00 788742 /usr/lib/libSM.so.6.0.1
007e2000-007f7000 r-xp 00000000 07:00 788721 /usr/lib/libICE.so.6.3.0
007f7000-007f8000 r--p 00014000 07:00 788721 /usr/lib/libICE.so.6.3.0
007f8000-007f9000 rw-p 00015000 07:00 788721 /usr/lib/libICE.so.6.3.0Abortado
As far as my newbie knowledge lets me, I see an SFM::Error message, so it looks controlled. But Ruby crashes (or it seems to me, maybe it's normal, i'm newbie with Ruby, sorry):