Exceptions in Squeak

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

Exceptions in Squeak

Waldemar Schwan-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> What I wanted was an exception (try/except) in case any of the reads
> failed. Corrupt files are an expected case that should be handled by
> the program. So I can't crash while reading (or writing). Does Squeak
> have exceptions? Or is there a Smalltalk pattern for this "try to
> execute this, do something else if it fails"? That answer should
> probably go into another thread.
>
> David

You may take a look at BlockContext, exception protocoll. BlockContext  
is the class of [ ] .

If you are searching for a try catch, try
        [ self doingThingsThatMayThrowErrors ] on: Error do: [ something ].

example:
        [ Error new signal] on: Error do: [Transcript show: 'error'].


Regards
        Waldemar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAki92ZkACgkQr7Iyerpx99kAXwCdHJNnjyMUr7UjK4HSvJdc4F8P
3TEAniVFQcpH6IdXfF1QDeyBDieEquFq
=U60m
-----END PGP SIGNATURE-----
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners