<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Sorry for the that, I mean my problem is I put the exception in the wrong part of my program, so everytime I try to call it in the method it does not return the exception, so what i did was:<br><br>1. Create an new exception class, which is: FileNotFoundError<br><br>Smalltalk.Core defineClass: #FileNotFound<br>&nbsp;&nbsp;&nbsp; superclass: #{Core.Error}<br>&nbsp;&nbsp;&nbsp; indexedType: #none<br>&nbsp;&nbsp;&nbsp; private: false<br>&nbsp;&nbsp;&nbsp; instanceVariableNames: ''<br>&nbsp;&nbsp;&nbsp; classInstanceVariableNames: ''<br>&nbsp;&nbsp;&nbsp; imports: ''<br>&nbsp;&nbsp;&nbsp; category: ''<br><br>2. I use that new exception to raise signal on a FileNotFoundError.<br>&nbsp;&nbsp;&nbsp; fileNotFound<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 ^FileNotFound raiseSignal: 'The file is not exist'<br><br>At first I'm using handler on:[...] do: [..] but&nbsp; I only need to define my own description of FileNotFoundError so that's all I need to do.<br><br>I'm still a beginner so sometimes I misunderstood&nbsp; and get confused.<br><br>Really appreciate all your help.<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Alex Chi &lt;alex_chi99@yahoo.com&gt;<br>To: beginners@lists.squeakfoundation.org<br>Sent: Monday, October 13, 2008 5:18:43 PM<br>Subject: Re: [Newbies] How to create new exception<br><br>
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>Thank you all!<br>I already solved my problem. Thanks for your help.<br><br>regards,<br><br>alex<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Alex Chi &lt;alex_chi99@yahoo.com&gt;<br>To: beginners@lists.squeakfoundation.org<br>Sent: Monday, October 13, 2008 12:31:18 PM<br>Subject: Re: [Newbies] How to create new exception<br><br>
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;">Thanks a lot for all the information.<br>1 more question, after create a new exception class then to use it let's say I have to define something like:<br>Then use it:<br>
<br>
[SpontaneousCombustionException signal]<br>
&nbsp; &nbsp; on: SpontaneousCombustionException<br>
&nbsp; &nbsp; do: [:ex | Transcript show: 'Explosion detected'; cr]<br><br>My question is where do I write this code? Is it in one of my method for example I create spontaneousCombustionSignal method, and I write this code there?<br><br><br><br>
&gt;&gt;&gt;&gt;&gt; "Alex" == Alex Chi &lt;<a rel="nofollow" ymailto="mailto:alex_chi99@yahoo.com" target="_blank" href="mailto:alex_chi99@yahoo.com">alex_chi99@yahoo.com</a>&gt; writes:<br><br>Alex&gt; Can you give me an example on how to create new exception and call/use<br>Alex&gt; that exception in my program? I try to googling but don't seem to find<br>Alex&gt; one. Thanks.<br>------------------------------<br><br>Message: 4<br>Date: Sun, 12 Oct 2008 09:20:00 -0700<br>From: Matthew Fulmer &lt;<a rel="nofollow" ymailto="mailto:tapplek@gmail.com" target="_blank" href="mailto:tapplek@gmail.com">tapplek@gmail.com</a>&gt;<br>Subject: Re: [Newbies] How to create new exception<br>To: <a rel="nofollow" ymailto="mailto:beginners@lists.squeakfoundation.org" target="_blank" href="mailto:beginners@lists.squeakfoundation.org">beginners@lists.squeakfoundation.org</a><br>Message-ID: &lt;<span class="yshortcuts"
 id="lw_1224043895_3">20081012162000</span>.GG5308@tacobell&gt;<br>Content-Type:
 text/plain; charset=us-ascii<br><br>On Sun, Oct 12, 2008 at 01:50:05AM -0700, Alex Chi wrote:<br>&gt;
Can you give me an example on how to create new exception and call/use
that exception in my program? I try to googling but don't seem to find
one. Thanks.<br><br>Create an exception class:<br><br>Exception subclass: #SpontaneousCombustionException<br>&nbsp; &nbsp; instanceVariableNames: ''<br>&nbsp; &nbsp; classVariableNames: ''<br>&nbsp; &nbsp; poolDictionaries: ''<br>&nbsp; &nbsp; category: 'Heat'.<br><br>Then use it:<br><br>[SpontaneousCombustionException signal]<br>&nbsp; &nbsp; on: SpontaneousCombustionException<br>&nbsp; &nbsp; do: [:ex | Transcript show: 'Explosion detected'; cr]<br><br>-- <br>Matthew Fulmer -- <a rel="nofollow" target="_blank" href="http://mtfulmer.wordpress.com/">http://mtfulmer.wordpress.com/</a><br>See if this helps.<br><br>&nbsp; <a rel="nofollow" target="_blank" href="http://www.cincomsmalltalk.com/userblogs/cincom/digest?content=2001-files-exceptions">http://www.cincomsmalltalk.com/userblogs/cincom/digest?content=2001-files-exceptions</a><br><br>It's a bit dated but it might give you the information you need.<br>Even uses #on:do: like the
 ANSI standard suggests.<br><br>-- <br>Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095<br>&lt;<a rel="nofollow" ymailto="mailto:merlyn@stonehenge.com" target="_blank" href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>&gt; &lt;URL:<a rel="nofollow" target="_blank" href="http://www.stonehenge.com/merlyn/">http://www.stonehenge.com/merlyn/</a>&gt;<br>Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.<br>See <a rel="nofollow" target="_blank" href="http://methodsandmessages.vox.com/">http://methodsandmessages.vox.com/</a> for Smalltalk and Seaside discussion<br></div></div></div><br>



      </div></div></div><br>



      </div></div></div><br>



      </body></html>