This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Catch and errMsg

Old posts that have not been replied to for several years.
Locked
T
TeDDyBeeR

Catch and errMsg

Post by TeDDyBeeR »

Hello Can someone help me out...

I try to copy a file (i know that command) but i want to catch the error message of it... but if there is now errormessage then the bot zefl will give an error

Code: Select all

proc { ...  }  {
   ....
   catch {[file copy -force ${rtmemomem} ${rtmemotmp}]} errMsg
   putlog "Result: $errMsg"
   if {$errMsg == ""} {
   .....
   } else {
   ......
   }
}
if there is an error 'errMsg' wil be text else the bot will generate this error:

Code: Select all

 Result: invalid command name "" 
This error will generate when 'errMsg' is noting ot is not set

already thx for thous hwo can hel pme out :lol:

greets TeDDyBeeR
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Note your use of the catch command

Code: Select all

catch {[file copy -force ${rtmemomem} ${rtmemotmp}]} errMsg
You have enclosed the file command within [].

You should use it without this.

Think of the catch command, as a wrapper

Code: Select all

file copy -force ${rtmemomem} ${rtmemotmp}
You wrap this command with catch.
T
TeDDyBeeR

Post by TeDDyBeeR »

oke so i must user this code :

Code: Select all

catch {file copy -force ${rtmemomem} ${rtmemotmp}} errMsg 
i will try it

thx PPSlim :lol:
T
TeDDyBeeR

Post by TeDDyBeeR »

It works great

Thx agian PPSlim :)
Problem is solved. No other solutions need :o
Greetz TeDDyBeeR
Locked