OK - a few things here:
First of all, a try/catch construct will take precedence over a thrown error. That's by design, as it allows you to handle errors locally before control gets handed off to the more generic error-handling routines.
Secondly, you may want to stick with the try/catch handlers, as there's a big difference in the way try/catch and errorDialog processing takes place: try/catch will allow you to deal with the error yourself and continue processing if so desired. Throwing an error to the errorDialog process stops the execution of the running script.
Also, note that you can throw an error in a catch construct in order the have the error bubble up to the caller of the handler that caused the error.
Third, I got successful results from the following, but I've found that lockErrorDialogs seems to be sticky (restarting the IDE cleared things up and got the first example here working after it stopped responding):
Code: Select all
on mouseUp
local dbID, SQL
revExecuteSQL dbID, SQL
end mouseUp
on errorDialog pExecutionError, pParseError
answer "An error occurred on line: " & item 2 of line 1 of pExecutionError
end errorDialog
which displays the answer dialog correctly.
Code: Select all
on mouseUp
local dbID, SQL
try
revExecuteSQL dbID, SQL
catch e
answer "caught" && e
end try
end mouseUp
which again displays the answer dialog correctly.
Also, earlier you posted
And, I know, this has nothing to do with the errorDialog handler.
as a comment to turning off Script Debug Mode and hitting an errorDialog routine. Actually that has everything to do with errorDialog. That's the IDE's builtin errorDialog handler in action. If you turn on Script Debug Mode you'll end up in the script editor debugger with the errant line highlighted. In a standalone you won't have the IDE available, so if you want to see the errors you'll have to set lockErrorDialogs to true in order to trigger your errorDialog handler.