Mercurial > hg > skillbot
comparison skillbot.pl @ 66:de14128c1858
Switching to eval for update error handling
author | Dominic Cleal <dominic@computerkb.co.uk> |
---|---|
date | Sat, 21 Nov 2009 12:40:32 +0000 |
parents | 962dada7587e |
children | 5db6fd5ffe17 |
comparison
equal
deleted
inserted
replaced
64:962dada7587e | 66:de14128c1858 |
---|---|
486 { | 486 { |
487 my $self = shift; | 487 my $self = shift; |
488 my $f = shift; | 488 my $f = shift; |
489 | 489 |
490 # Don't attempt updates during downtime, can cause crash | 490 # Don't attempt updates during downtime, can cause crash |
491 return if (timestamp_in_downtime(time)); | 491 # return if (timestamp_in_downtime(time)); |
492 | 492 |
493 my $char_skill = $f->{char_api}->skill; | 493 my $char_skill; |
494 eval { $char_skill = $f->{char_api}->skill; } | |
495 warn $@ if $@; | |
496 | |
494 # Sometimes this is undefined if there's an API error, try later | 497 # Sometimes this is undefined if there's an API error, try later |
495 return unless defined $char_skill; | 498 return unless defined $char_skill; |
496 | 499 |
497 my $skill = $char_skill->in_training; | 500 my $skill = $char_skill->in_training; |
498 | 501 |
511 # Check for changes in the skill, skip or cancel announcement | 514 # Check for changes in the skill, skip or cancel announcement |
512 if (defined $f->{skill}) { | 515 if (defined $f->{skill}) { |
513 # If the skill's the same, check the finish time and skip if | 516 # If the skill's the same, check the finish time and skip if |
514 # nothing's changed | 517 # nothing's changed |
515 return if ($skill->id eq $f->{skill} | 518 return if ($skill->id eq $f->{skill} |
516 && $f{$f->{skill_finish} == $skill->finish_time); | 519 && $f->{skill_finish} == $skill->finish_time); |
517 | 520 |
518 # Skill or finish time has changed, delete previous announcement | 521 # Skill or finish time has changed, delete previous announcement |
519 del_one_shot_timer($f->{timer}); | 522 del_one_shot_timer($f->{timer}); |
520 delete $f->{timer}; | 523 delete $f->{timer}; |
521 } | 524 } |