<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://atk-framework.com/index.php?action=history&amp;feed=atom&amp;title=Error_handling</id>
	<title>Error handling - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://atk-framework.com/index.php?action=history&amp;feed=atom&amp;title=Error_handling"/>
	<link rel="alternate" type="text/html" href="https://atk-framework.com/index.php?title=Error_handling&amp;action=history"/>
	<updated>2026-09-20T19:43:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://atk-framework.com/index.php?title=Error_handling&amp;diff=19621&amp;oldid=prev</id>
		<title>Bahati at 09:30, 11 March 2011</title>
		<link rel="alternate" type="text/html" href="https://atk-framework.com/index.php?title=Error_handling&amp;diff=19621&amp;oldid=prev"/>
		<updated>2011-03-11T09:30:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:30, 11 March 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Howto|easy|[[Mark Wittens]] &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;mark@ibuildings.nl&amp;gt;&lt;/del&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Howto|easy|[[Mark Wittens]] }}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Preface ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Preface ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bahati</name></author>
	</entry>
	<entry>
		<id>https://atk-framework.com/index.php?title=Error_handling&amp;diff=17795&amp;oldid=prev</id>
		<title>Mark: New page: {{Howto|easy|Mark Wittens &lt;mark@ibuildings.nl&gt;}}  == Preface == If an error occurs in ATK it can be sent by email to you or anyone who might be interested so the error can be fixed as ...</title>
		<link rel="alternate" type="text/html" href="https://atk-framework.com/index.php?title=Error_handling&amp;diff=17795&amp;oldid=prev"/>
		<updated>2008-12-03T10:16:54Z</updated>

		<summary type="html">&lt;p&gt;New page: {{Howto|easy|&lt;a href=&quot;/index.php?title=Mark_Wittens&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Mark Wittens (page does not exist)&quot;&gt;Mark Wittens&lt;/a&gt; &amp;lt;mark@ibuildings.nl&amp;gt;}}  == Preface == If an error occurs in ATK it can be sent by email to you or anyone who might be interested so the error can be fixed as ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Howto|easy|[[Mark Wittens]] &amp;lt;mark@ibuildings.nl&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Preface ==&lt;br /&gt;
If an error occurs in ATK it can be sent by email to you or anyone who might be interested so the error can be fixed as fast as possible. It is also possible to log the error in Zend Platform and you could even do something entirely different if you like. How to enable an existing error handler and how to create your own custom handler will be explained in this how-to.&lt;br /&gt;
&lt;br /&gt;
== Enable error handling ==&lt;br /&gt;
&lt;br /&gt;
The usual way to tell ATK to mail the error would be to set the config value $config_mailreport with a valid email address.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  $config_mailreport = &amp;quot;someone@somewhere.com&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you would like to have multiple error handlers or you want to handle it differently you can use the following config value:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  $config_error_handlers = array(&amp;#039;mail&amp;#039;=&amp;gt;array(&amp;#039;mailto&amp;#039;=&amp;gt;&amp;#039;someone@somewhere.com&amp;#039;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This has the same result as the original code, the array with the &amp;#039;mailto&amp;#039; key will be passed to the error handler but we will get to this later.&lt;br /&gt;
It already gets a bit more interesting when we add another error handler:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  $config_error_handlers = array(&amp;#039;ZendPlatform&amp;#039;, &amp;#039;mail&amp;#039;=&amp;gt;array(&amp;#039;mailto&amp;#039;=&amp;gt;&amp;#039;someone@somewhere.com&amp;#039;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From now on, not only will the error be sent by mail but it also gets logged in Zend Platform! (if Zend Platform is available offcourse)&lt;br /&gt;
&lt;br /&gt;
== Create a new error handler ==&lt;br /&gt;
Suppose you would like to do something different in case of an error, you might want to send it to all of your friends by e-card or do something usefull with it. To do so you can create your own error handler.&lt;br /&gt;
&lt;br /&gt;
First, create a file named class.atk&amp;lt;your error handler name here&amp;gt;errorhandler.inc in atk/errors/. In this file you&amp;#039;ll need to create a new class named atk&amp;lt;your error handler name here&amp;gt;ErrorHandler and derive it from atkErrorHandlerBase. It&amp;#039;s easier to just look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  class atk&amp;lt;your error handler name here&amp;gt;ErrorHandler extends atkErrorHandlerBase&lt;br /&gt;
  {   &lt;br /&gt;
    public function handle($errorMessage, $debugMessage)&lt;br /&gt;
    {&lt;br /&gt;
      // Do something interesting with the error here&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you add your handler&amp;#039;s name to the config the handle() function of your class will be called in case of an error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  $config_error_handlers = array(&amp;#039;&amp;lt;your error handler name here&amp;gt;&amp;#039;, &amp;#039;ZendPlatform&amp;#039;, &amp;#039;mail&amp;#039;=&amp;gt;array(&amp;#039;mailto&amp;#039;=&amp;gt;&amp;#039;someone@somewhere.com&amp;#039;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to pass config values to the error handler this can be done by adding those as an array value to the key you just added:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  $config_error_handlers = array(&amp;#039;&amp;lt;your error handler name here&amp;gt;&amp;#039; =&amp;gt; array(&amp;#039;value1&amp;#039;=&amp;gt;1, &amp;#039;value2&amp;#039;=&amp;gt;2) , &amp;#039;ZendPlatform&amp;#039;, &amp;#039;mail&amp;#039;=&amp;gt;array(&amp;#039;mailto&amp;#039;=&amp;gt;&amp;#039;someone@somewhere.com&amp;#039;));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The values will be accessible from the error handler through the $this-&amp;gt;params member variable. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
  class atk&amp;lt;your error handler name here&amp;gt;ErrorHandler extends atkErrorHandlerBase&lt;br /&gt;
  {   &lt;br /&gt;
    public function handle($errorMessage, $debugMessage)&lt;br /&gt;
    {&lt;br /&gt;
      echo $this-&amp;gt;params[&amp;#039;value1&amp;#039;];&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>