Can't Trap Do Shell Script Error

Howdy!
I’m having a bit of a problem with errors from do shell script processes. This is a simplified version of a snippet of code that plays a movie using the UNIX executable mplayer when a button is pushed.

on clicked theObject
	set mplayerLoc to quoted form of "the path to mplayer"
	set theMovie to quoted form of "path to the movie file"
	playMov(mplayerLoc, theMovie)
end clicked


on playMov(mp, mv)
	try
		do shell script mp & " " & mv
		tell me to log ("OK")
	on error errMsg number errNum
		tell me to log ("error")
	end try
end playMov

When I run the script in xcode and click on the button, the movie plays fine, but the problem is that there is a bug in mplayer so that if you close the player window by clicking on its red close control (what do you call that thingy?) mplayer crashes. When that happens, for some reason, the sripts locks up and a new copy of the script launches. If I try this in script debugger (minus the buttons) the error gets logged and the script can go on with its business. Am I missing something obvious?

Any ideas would be appreciated.

Have you tried to send the errors to a file?

For example:

do shell script "mkdir /MyTestFolder > /dev/null 2>&1"

In this case you actually send all the output to /dev/null.
I’m not shure but i thought when you send the output to > /dev/null 2> It would only send the errors to dev/null
/dev/null is a not existing device. So you basically say don’t give me errors.

Have a look at this thread as well.

Thanks for the ideas Craig and jaspersiegers. I’d forgotten the trick with sending errors to dev/null (I’m not a UNIX guy). Unfortunately, I tried both with no luck. However, after some more experimenting it looks like this might be a non-issue, though perhaps an inconvenience if it shows up in other work. It seems the script won’t trap the errors when run in xcode, but when run as an application from the finder it traps the error with no issues. I’m not sure why, but this isn’t the first time I’ve seen behavior that I don’t understand :). If anyone has any ideas on this strange behavior (for future reference) I’d love to here it. Thanks again for responding.