Pharo by Example - chapter about Exception - Error - Notification - Abort?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Pharo by Example - chapter about Exception - Error - Notification - Abort?

Bart Gauquie
Dear all,

I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.

I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.

Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.

Kind Regards,

Bart

--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Schwab,Wilhelm K
If nothing else, it deserves a section, probably after bocks, conditionals and loops.  If nobody else wants to be bothered, I can draft something.
 
 
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Bart Gauquie
Sent: Monday, November 23, 2009 3:06 AM
To: [hidden email]
Subject: [Pharo-project] Pharo by Example - chapter about Exception - Error - Notification - Abort?

Dear all,

I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.

I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.

Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.

Kind Regards,

Bart

--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Simon Denier-3

On 23 nov. 2009, at 08:59, Schwab,Wilhelm K wrote:

If nothing else, it deserves a section, probably after bocks, conditionals and loops.  If nobody else wants to be bothered, I can draft something.


Dont even start! There is already one, although it is scheduled for the 2nd edition of PBE. So you have to download the latex sources and compile it yourself (note: each chapter of the book can be compiled independently of the others)

 
 
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Bart Gauquie
Sent: Monday, November 23, 2009 3:06 AM
To: [hidden email]
Subject: [Pharo-project] Pharo by Example - chapter about Exception - Error - Notification - Abort?

Dear all,

I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.

I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.

Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.

Kind Regards,

Bart

--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
 Simon




_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Stéphane Ducasse
In reply to this post by Bart Gauquie


Enjoy I had a lot of fun writing it when my family went to the swimming pool and I could concentrate :)

Stef

On Nov 23, 2009, at 9:05 AM, Bart Gauquie wrote:

> Dear all,
>
> I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.
>
> I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.
>
> Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.
>
> Kind Regards,
>
> Bart
>
> --
> imagination is more important than knowledge - Albert Einstein
> Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> Gravitation is not responsible for people falling in love. - Albert Einstein
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Exceptions.pdf (506K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Bart Gauquie
Thanks very much,

Bart

2009/11/23 Stéphane Ducasse <[hidden email]>


Enjoy I had a lot of fun writing it when my family went to the swimming pool and I could concentrate :)

Stef

On Nov 23, 2009, at 9:05 AM, Bart Gauquie wrote:

> Dear all,
>
> I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.
>
> I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.
>
> Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.
>
> Kind Regards,
>
> Bart
>
> --
> imagination is more important than knowledge - Albert Einstein
> Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> Gravitation is not responsible for people falling in love. - Albert Einstein
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

csrabak
In reply to this post by Stéphane Ducasse
I started reading it.  It seems to me that at page 5 the last paragraph "If Smalltalk did provide exception-handling support, then the tiny example we saw in the previous section would be written something like this," is missing a negative like «"If Smalltalk did *not* provide exception-handling support..."».

Isn't it?

--
Cesar Rabak

Em 23/11/2009 16:57, Stéphane Ducasse < [hidden email] > escreveu:

> Enjoy I had a lot of fun writing it when my family went to the swimming pool and I could
> concentrate :)


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Bart Gauquie
In reply to this post by Stéphane Ducasse
I enjoyed the chapter :-). It was very informative, and illustrated yet again how flexible Smalltalk can be. Is there any particular reason why this 'essential' chapter was not included in the first edition of Pharo by Example?

I also have a question about the contents. In chapter '1.14 Catching sets of exceptions' it is explained how catch a set of exceptions but not how to define a different handler on each exception. For instance i want to handle a more specific FileDoesNotExistException in a different way than a more general FileStreamException, or even Exception.  The way i can do this, i see, is to test which type of exception is coming into the do: block and execute appropriate code. This is a very bad solution. Or secondly, to create nested on: do: blocks with the most specific exception as inner block. This seems better, but is kind of verbose. 
Is there another way to solve this problem?

Kind regards,

Bart

2009/11/23 Stéphane Ducasse <[hidden email]>


Enjoy I had a lot of fun writing it when my family went to the swimming pool and I could concentrate :)

Stef

On Nov 23, 2009, at 9:05 AM, Bart Gauquie wrote:

> Dear all,
>
> I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.
>
> I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.
>
> Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.
>
> Kind Regards,
>
> Bart
>
> --
> imagination is more important than knowledge - Albert Einstein
> Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> Gravitation is not responsible for people falling in love. - Albert Einstein
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Henrik Sperre Johansen

On Nov 24, 2009, at 11:09 44AM, Bart Gauquie wrote:

> I enjoyed the chapter :-). It was very informative, and illustrated yet again how flexible Smalltalk can be. Is there any particular reason why this 'essential' chapter was not included in the first edition of Pharo by Example?
It wasn't done yet, probably :)
>
> I also have a question about the contents. In chapter '1.14 Catching sets of exceptions' it is explained how catch a set of exceptions but not how to define a different handler on each exception. For instance i want to handle a more specific FileDoesNotExistException in a different way than a more general FileStreamException, or even Exception.  The way i can do this, i see, is to test which type of exception is coming into the do: block and execute appropriate code. This is a very bad solution. Or secondly, to create nested on: do: blocks with the most specific exception as inner block. This seems better, but is kind of verbose.
> Is there another way to solve this problem?
This was discussed abit some time ago, might want to read:

http://n2.nabble.com/better-error-handling-td3750946.html#a3750946

Cheers,
Henry
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Alexandre Bergel
In reply to this post by Bart Gauquie
> I enjoyed the chapter :-). It was very informative, and illustrated  
> yet again how flexible Smalltalk can be. Is there any particular  
> reason why this 'essential' chapter was not included in the first  
> edition of Pharo by Example?

lack of time was the reason.

> I also have a question about the contents. In chapter '1.14 Catching  
> sets of exceptions' it is explained how catch a set of exceptions  
> but not how to define a different handler on each exception. For  
> instance i want to handle a more specific FileDoesNotExistException  
> in a different way than a more general FileStreamException, or even  
> Exception.  The way i can do this, i see, is to test which type of  
> exception is coming into the do: block and execute appropriate code.  
> This is a very bad solution. Or secondly, to create nested on: do:  
> blocks with the most specific exception as inner block. This seems  
> better, but is kind of verbose.
> Is there another way to solve this problem?

Visualworks uses HandlerList for this.
One of the think you can do, is
   * either to nest block handlers [[ ex ] on: Error1 do: [:ex|...]]  
on: Error2 do: [:ex|...]. But in that case you should take care of  
inheritance relationship between Error1 and Error2. It does not work  
for any Error1 and Error2 classes
   * you can use a double dispatch on the exception

Cheers,
Alexandre


>
> Kind regards,
>
> Bart
>
> 2009/11/23 Stéphane Ducasse <[hidden email]>
>
>
> Enjoy I had a lot of fun writing it when my family went to the  
> swimming pool and I could concentrate :)
>
> Stef
>
> On Nov 23, 2009, at 9:05 AM, Bart Gauquie wrote:
>
> > Dear all,
> >
> > I've been searching the Pharo by Example book about how to handle  
> Exception, Error, ... in Pharo.
> >
> > I've found some information about it in the SUnit chapter, in  
> method 7.11: Catching test case errors and failures; this is only a  
> small fragment however.
> >
> > Is there any chapter planned about this topic? It would be very  
> useful i think, since it is an important topic, and I've read that  
> Smalltalks exception handling is very powerful, but I don't know  
> much about it and like to learn it.
> >
> > Kind Regards,
> >
> > Bart
> >
> > --
> > imagination is more important than knowledge - Albert Einstein
> > Logic will get you from A to B. Imagination will take you  
> everywhere - Albert Einstein
> > Learn from yesterday, live for today, hope for tomorrow. The  
> important thing is not to stop questioning. - Albert Einstein
> > The true sign of intelligence is not knowledge but imagination. -  
> Albert Einstein
> > Gravitation is not responsible for people falling in love. -  
> Albert Einstein
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>
> --
> imagination is more important than knowledge - Albert Einstein
> Logic will get you from A to B. Imagination will take you everywhere  
> - Albert Einstein
> Learn from yesterday, live for today, hope for tomorrow. The  
> important thing is not to stop questioning. - Albert Einstein
> The true sign of intelligence is not knowledge but imagination. -  
> Albert Einstein
> Gravitation is not responsible for people falling in love. - Albert  
> Einstein
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharo by Example - chapter about Exception - Error - Notification - Abort?

Stéphane Ducasse
In reply to this post by Bart Gauquie
> I enjoyed the chapter :-). It was very informative, and illustrated yet again how flexible Smalltalk can be. Is there any particular reason why this 'essential' chapter was not included in the first edition of Pharo by Example?

- It was not written
- we want to have a cool second volume and
- pharo by example can already get out for other languages using squeak by example translation,
so we do not want to force translater that already translate squeak by example to have to translate
too many new chapters.

>
> I also have a question about the contents. In chapter '1.14 Catching sets of exceptions' it is explained how catch a set of exceptions but not how to define a different handler on each exception. For instance i want to handle a more specific FileDoesNotExistException in a different way than a more general FileStreamException, or even Exception.  The way i can do this, i see, is to test which type of exception is coming into the do: block and execute appropriate code. This is a very bad solution. Or secondly, to create nested on: do: blocks with the most specific exception as inner block. This seems better, but is kind of verbose.
> Is there another way to solve this problem?
>
> Kind regards,
>
> Bart
>
> 2009/11/23 Stéphane Ducasse <[hidden email]>
>
>
> Enjoy I had a lot of fun writing it when my family went to the swimming pool and I could concentrate :)
>
> Stef
>
> On Nov 23, 2009, at 9:05 AM, Bart Gauquie wrote:
>
> > Dear all,
> >
> > I've been searching the Pharo by Example book about how to handle Exception, Error, ... in Pharo.
> >
> > I've found some information about it in the SUnit chapter, in method 7.11: Catching test case errors and failures; this is only a small fragment however.
> >
> > Is there any chapter planned about this topic? It would be very useful i think, since it is an important topic, and I've read that Smalltalks exception handling is very powerful, but I don't know much about it and like to learn it.
> >
> > Kind Regards,
> >
> > Bart
> >
> > --
> > imagination is more important than knowledge - Albert Einstein
> > Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> > Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> > The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> > Gravitation is not responsible for people falling in love. - Albert Einstein
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>
> --
> imagination is more important than knowledge - Albert Einstein
> Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> Gravitation is not responsible for people falling in love. - Albert Einstein
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project