Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56633 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86135 invoked from network); 25 Nov 2011 12:13:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2011 12:13:43 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:39123] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/81-12107-6768FCE4 for ; Fri, 25 Nov 2011 07:13:42 -0500 Received: by qabg40 with SMTP id g40so315944qab.8 for ; Fri, 25 Nov 2011 04:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=didTrfR2u0rWD+z4iAlu2wQTBsAviCGYbPMaU4Rvins=; b=gzvvEf0S1oTTcKzB310sAMOwhoAKTwr5IdAKTKHZwAGip5qHlji65Gn8FtT0lSkq4T 4gXc9DG1NkevsV5Wq5aCPcZ9WDX/NBL/kcYTqaxd5N27IUdydVxDsFVAuEjZepqr94hg EhlC9Qw2+pXhdb3ps/h4YT5gWj9P+OIKvrxEM= MIME-Version: 1.0 Received: by 10.224.184.143 with SMTP id ck15mr5231675qab.22.1322223219601; Fri, 25 Nov 2011 04:13:39 -0800 (PST) Received: by 10.229.38.134 with HTTP; Fri, 25 Nov 2011 04:13:39 -0800 (PST) In-Reply-To: References: <4ECEC513.9040706@mohiva.com> <06acba1a1c53ac9527beb807787c92aa@mohiva.com> Date: Fri, 25 Nov 2011 13:13:39 +0100 Message-ID: To: Christian Kaps Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf30334fb55171a304b28e15fb Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Error Handling From: tyra3l@gmail.com (Ferenc Kovacs) --20cf30334fb55171a304b28e15fb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =3D new ReflectionClass($**annotationName); > } catch (ClassNotFoundException $e) { > $message =3D "The annotation class `{$annotationName}` cannot be found;= "; > $message .=3D "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 =3D new ReflectionClass($**annotationName); } but in this particular case I don't see how could that class missing (Reflection is a built in extension, always enabled). --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --20cf30334fb55171a304b28e15fb--