renathy Posted October 18, 2010 Report Share Posted October 18, 2010 Kā Jūs principiāli mēdzat apstrādāt kļūdu paziņojumus? Piemēram, funkcija user_exists atdod true/false attiecīgi, bet kā apstrādāt teiksim, ja iekš user_exists neizdodas pieslēgties db, vai lietot die vai kā citādi? Kāda ir prakse, varbūt kādi raksti? Quote Link to comment Share on other sites More sharing options...
codez Posted October 18, 2010 Report Share Posted October 18, 2010 exception-i Quote Link to comment Share on other sites More sharing options...
briedis Posted October 18, 2010 Report Share Posted October 18, 2010 Nez, man, ja neizdodas pieslēgties db tad sākumā ir vienkāršs die("DB failed.") un viss. Lapa nevar normāli funkcionēt bez db... Quote Link to comment Share on other sites More sharing options...
renathy Posted October 18, 2010 Author Report Share Posted October 18, 2010 Un ja neizdodas kkādu sqlu palaist, arī vienkārši die? R. Quote Link to comment Share on other sites More sharing options...
briedis Posted October 18, 2010 Report Share Posted October 18, 2010 sql'u parasti neizdodas palaist, ja ir kļūdains kvērijs, vai nav db konekcijas. Var, kā jau tik minēts, mētāta exception'us. Varbūt vari parādīt kādu koda piemēru, kas tev raisa bažas? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted October 18, 2010 Report Share Posted October 18, 2010 Ja kaut kas kritisks, bez kaa lapa nevar darboties, tad parasti ir funkcija, piem, do_fatal(), kas publiskai lapai paraadiis kaadu maintenance, vai error lapu, bet development lapai paraadiis kljuudu, backtrace, utt... Ja kaut kas ne-kritisks no kaa var atguuties, tad vai nu exception's vai return false vai kaut kas taads un tad jau izsaucoshaa f-ja domaa ko dariit ar to taalaak. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.