error portion of try-on error block does not see coerced error

In a part of my AppleScript Studio code I have:


error number 2000 -- staying away from Apple's negative numbers

Later, I have:


try

on error errMsg number errNum
       if errNum is 2000 then doSomething()

end try

My doSomething() is never called; rather, AppleScript itself puts up a generic window noting the errNum and that’s it.

Help!!

Try blocks only handle errors that happen inside the block…

try
	error number 2000
	display dialog "No errors so far."
on error errMsg number errNum
	display dialog errNum
end try

See also: Try

I knew (should have known) that.

Sorry, Bruce