Hi,
I have this application where any unexpected errors are written to a log using a subroutine. I expect errors 3 and -1700, but -1700 won’t get ignored.
try
(*Do some stuff*)
on error err number num
if (num ≠-1700) and (num ≠3) then write_log from (err & " (" & num & ")")
(*Do some stuff*)
end try
Anyone know how to fix this? -1700 would clog up the log file a lot.
AppleScript: 17826304
Operating System: Mac OS X (10.5)
Hi,
what’s about debugging the code?
unexpected errors are uncool
the logic in your script is
(not 3) and (not -1700)
– 3 1700
– is not is not → log
– is is not → log
– is not is → log
– is is → not log
but you want NAND, which is in fact OR
(not 3) or (not -1700)
– 3 1700
– is not is not → log
– is is not → not log
– is not is → not log
– is is → not log
(num ≠-1700) OR (num ≠3) produces a log for both of them.
Do you mean EXOR (Exclusive OR)?
If so, how am I supposed to do that in AS?
you’ re right, I’ve tried to think too much outside the box
simulating error -1700, this works
try
"B" as integer -- causes error -1700
on error number num
if (num ≠-1700) and (num ≠3) then say "log"
end try
You’re right, that works.
But a different cause seems to have a different effect.
err = Can’t make characters 2 thru -1 of “~” into type Unicode text.
num = -1700
Even something like (num does not contain “characters”) produces a log.
Sorry about all this. I’d put (num ≠-1700) in the wrong place, not realising there was another try statement in the other section.
But thanks for you’re time.