Rescue exception

Hi,

I had a question about exception in ruby.

In the following code:

begin
	# do something
rescue
	# error caught
end

The exception is NOT caught, but if I write:

begin
	# do something
rescue Exception
	# error caught
end

Error is caught. Could any one tell me if I ommit the Exception after
rescue, what is it trying to rescue?

Thanks a lot.

···


Xiangrong Fang xrfang@hotmail.com

Descendants of StandardError, IIRC.

-austin

···

On Sat, 16 Aug 2003 11:53:58 +0900, Xiangrong Fang wrote:

I had a question about exception in ruby.

In the following code:

begin

do something

rescue

error caught

end

The exception is NOT caught, but if I write:

begin

do something

rescue Exception

error caught

end

Error is caught. Could any one tell me if I ommit the Exception after
rescue, what is it trying to rescue?


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.08.16
* 00.54.00

Thank you Austin.

Shannon

···

On Sat, 16 Aug 2003 13:55:15 +0900 Austin Ziegler austin@halostatue.ca wrote:

On Sat, 16 Aug 2003 11:53:58 +0900, Xiangrong Fang wrote:

I had a question about exception in ruby.

In the following code:

begin

do something

rescue

error caught

end

The exception is NOT caught, but if I write:

begin

do something

rescue Exception

error caught

end

Error is caught. Could any one tell me if I ommit the Exception after
rescue, what is it trying to rescue?

Descendants of StandardError, IIRC.

-austin

austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.08.16
* 00.54.00


Xiangrong Fang xrfang@hotmail.com