Languages :: PHP :: die()ing without really die()ing, on error in class function |
|||
| By: FiatLink |
Date: 31/12/2004 10:22:40 |
Points: 50 | Status: Answered Quality : Excellent |
|
Hi, I've created a class which has a WriteError() method. WriteError() displays a table with error information. Once this does its thing, I want it to stop doing anything else. If I enter "die()" or "exit;" the information isn't displayed on the page. Is there an intermediate way of getting it to show the information and stop without an all-out die()? |
|||
| By: VGR | Date: 31/12/2004 10:26:21 | Type : Answer |
|
| back into your OOP design problems ? :D Anyway, you've three solutions : 1) flush() output before exitting; or die()ing - this is not guaranteed to work. 2) without die()ing or exit()ing, transmit the error to the upper level (caller) : 2a) with Exceptions in PHP5+ - I never tested this myself. 2b) return the error code/message to the caller - the classical modular way with a function() - and handle it at that level. That's my way. Regards, VGR |
|||
| By: FiatLink | Date: 08/01/2005 21:49:58 | Type : Comment |
|
| J'opte pour la solution 2b. Merci 8-) | |||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








