Re: cure for NSArgumentEvaluationScriptError?
Re: cure for NSArgumentEvaluationScriptError?
- Subject: Re: cure for NSArgumentEvaluationScriptError?
- From: jj <email@hidden>
- Date: Wed, 22 Sep 2004 10:48:26 +0200
> Help understanding the use of "errMSG" would be appreciated.
An error in AppleScript has four parameters, apart from the error message
itself. Take a look to this example, which still works and demonstrates the
existence of these:
##############################################
try
handle CGI request "káspita"
on error msg number n from obj to newClass partial result y
{msg:msg, n:n, obj:obj, newClass:newClass, y:y}
end try
-->
(*
{
msg:"The searching for parameter is missing for handle CGI request.",
n:-1701,
obj:«class kfor»,
newClass:handle CGI request,
y:«handler handle CGI request»
}
*)
on handle CGI request x searching for y
return ""
end handle CGI request
##############################################
In a try/on-error/end-try statement, the values of "msg" (or "errMSG" in
your example) and those parameters which optionally you include ("n",
"obj"...), are filled automatically when the error happens.
And you can create such errors yourself:
##############################################
error "This is a sample error" number 4271
##############################################
##############################################
try
error "This is a sample error" number 4271
on error msg number n
display dialog "Error number " & n & ":" & return & msg with icon 0
end
##############################################
(Apple says you may choose numbers 500 to 10000 in your errors, which won't
conflict with the system)
jj
--
http://www.macscripter.net/
http://www.osaxen.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden