Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88583 invoked from network); 25 Nov 2011 12:28:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2011 12:28:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=christian.kaps@mohiva.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=christian.kaps@mohiva.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mohiva.com from 80.67.31.27 cause and error) X-PHP-List-Original-Sender: christian.kaps@mohiva.com X-Host-Fingerprint: 80.67.31.27 smtprelay04.ispgateway.de Linux 2.6 Received: from [80.67.31.27] ([80.67.31.27:39792] helo=smtprelay04.ispgateway.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/F1-12107-1F98FCE4 for ; Fri, 25 Nov 2011 07:28:34 -0500 Received: from [80.67.16.111] (helo=webmail.df.eu) by smtprelay04.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1RTutK-0008WG-1T for internals@lists.php.net; Fri, 25 Nov 2011 13:28:30 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 25 Nov 2011 13:28:30 +0100 To: In-Reply-To: References: <4ECEC513.9040706@mohiva.com> <06acba1a1c53ac9527beb807787c92aa@mohiva.com> Message-ID: X-Sender: christian.kaps@mohiva.com User-Agent: Roundcube Webmail/0.6 X-Df-Sender: Y2hyaXN0aWFuLmthcHNAbW9oaXZhLmNvbQ== Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Error Handling From: christian.kaps@mohiva.com (Christian Kaps) Am 25.11.2011 13:13, schrieb Ferenc Kovacs: > On Fri, Nov 25, 2011 at 12:56 PM, Christian Kaps > wrote: > >> I surround my application with a try/catch block to catch uncaught >> exceptions. An autoloader exception could be one of them. >> >> But I use also similar calls to reformat error messages. >> >> try { >> $class = new ReflectionClass($**annotationName); >> } catch (ClassNotFoundException $e) { >> $message = "The annotation class `{$annotationName}` cannot be >> found; "; >> $message .= "called in DocBlock for: >> {$this->context->getLocation()**}; >> "; >> throw new ClassNotFoundException($**message, null, $e); >> } >> >> > if(!class_exists('ReflectionClass')){ > // call your error handler here or throw Exception as you like > } > else{ > $class = new ReflectionClass($**annotationName); > } > Reflection class triggers also the autoloader, because it tries to load the class $annotationName.