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.

When I recieve an error can i get it to try again

Old posts that have not been replied to for several years.
Locked
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

When I recieve an error can i get it to try again

Post by ShavdApe »

Ok not easy to explain in a topic.

I have an eggdrop that uses fbsql to connect to a mysl dbase and run querys. 90% of the time this goes smoothly but the other 10% of the time i get an error simmilar to the following.

Tcl error [join:chan]: Error 2013 (Lost connection to MySQL server during query)

Ok now I know what it means and the process here is not important.
What I would like to know is how I can deal with this.

for eg could I get the bot to echo the error to a specified chan and also could I get it upon recieving error it will try again upto a maximum of say 5 times.

Im kinda a noob at this stuff and i seem to stumble along as i go any and all help appreciated thank you.
User avatar
MD87
Voice
Posts: 23
Joined: Sat Dec 14, 2002 9:04 am
Location: Leicester, UK
Contact:

Post by MD87 »

You can use the trace command and the errorInfo variable. I wrote a tutorial on doing it for a friend a while ago - have a read here - just modify the middle bit of the code and replace it with your code to msg a channel :)
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Post by ShavdApe »

nice thanks for the info I will have a play around.

Much appreciated
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

MD87 wrote:You can use the trace command and the errorInfo variable.
Cool idea :) I think this might be something that GodOfSuicide could use for the issue he's mentioning in this post, untill (if it ever happens) eggdrop has been updated the way he wants.
However, I don't think it'll solve ShavedApe's problem.
ShavedApe wrote:What I would like to know is how I can deal with this.
Use 'catch'...eg:

Code: Select all

for {set i 0} {$i<5} {incr i} {
  if {[catch {
# insert code causing error here...
  } result]} {
    # there was an error...reopen the database connection or whatever you need to do
  } {
    # everything went fine...display the result or whatever and 'break' to exit the for-loop
  }
}
Have you ever read "The Manual"?
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Post by ShavdApe »

user /me loves you

Thank you very much you just saved me hours of hair pulling and shouting and my pc screen hehe.
Locked