You are here: Re: Retrying handled errors « PHP Programming Language « IT news, forums, messages
Re: Retrying handled errors

Posted by Richard Levasseur on 11/29/13 11:52

flamer die.spam@hotmail.com wrote:
> ImOk wrote:
>
> > I just have a question about trapping and retrying errors especially
> > file locking or database locks or duplicate key errors.
> >
> > Is there a way after you trap an error to retry the same line that
> > cause the error?
> >
> > In many other languages you have the option of rertying certain errors.
> > In effect, its like a return to the exact same line. You can then retry
> > certain # of times and then produce an error if it keeps failing.
>
> All I can think of is to use a loop
> while $result == null
> if ($retries > '3') { //do stuff $retries++ }
>
> or you can kill the script on error then reload the page
> header:$php_self?retries=$retries
>
> meh.. there is a way.. somehow.
>
> Flamer.

PHP5 doesn't have that feature, though i'd love to have that for some
situations, also.

I think c# has this feature, not sure though.

The best you could do is to nest a try/catch block within a loop and
use a control flag.

while($retry < 5) {
try{ .... } catch{$retry++; ... }
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация