<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.bebot.link/index.php?action=history&amp;feed=atom&amp;title=Error_module</id>
	<title>Error module - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.bebot.link/index.php?action=history&amp;feed=atom&amp;title=Error_module"/>
	<link rel="alternate" type="text/html" href="http://wiki.bebot.link/index.php?title=Error_module&amp;action=history"/>
	<updated>2026-05-25T22:09:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>http://wiki.bebot.link/index.php?title=Error_module&amp;diff=90&amp;oldid=prev</id>
		<title>B3b0tUzR: Created page with &#039;====== Introduction ====== The error module is intended as a tool to help uniform error handling in modules. The object of this class is to avoid returning arrays when errors are…&#039;</title>
		<link rel="alternate" type="text/html" href="http://wiki.bebot.link/index.php?title=Error_module&amp;diff=90&amp;oldid=prev"/>
		<updated>2020-09-16T22:43:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;====== Introduction ====== The error module is intended as a tool to help uniform error handling in modules. The object of this class is to avoid returning arrays when errors are…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;====== Introduction ======&lt;br /&gt;
The error module is intended as a tool to help uniform error handling in modules. The object of this class is to avoid returning arrays when errors are encountered.&lt;br /&gt;
&lt;br /&gt;
===== Setting an error =====&lt;br /&gt;
When something goes wrong in your module you can set the error like this&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$this -&amp;gt; error -&amp;gt; set(&amp;#039;Oops, something went wrong!&amp;#039;, $logging, $fatal);&lt;br /&gt;
return $this -&amp;gt; error -&amp;gt; message();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When used with the base module and un-customised tell(), gc() and pgmsg() this will send a tell to the person invoking the command that the module has had an error and the message you defined.&lt;br /&gt;
&lt;br /&gt;
If $logging == true then an entry will be logged to the console (via $this -&amp;gt; bot -&amp;gt; log())&lt;br /&gt;
If $fatal == true then the bot will halt execution with an error code of 1. Do NOT use this unless the error is such that the bot should stop execution.&lt;br /&gt;
&lt;br /&gt;
===== Checking if an error has occured =====&lt;br /&gt;
You can check if an error has been raised by comparing the error objects status to a boolean.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if($this-&amp;gt;error-&amp;gt;status() === true)&lt;br /&gt;
{&lt;br /&gt;
  //An error has occured&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Resetting the error object =====&lt;br /&gt;
This is particularly useful to do before the command is parsed so that a stale error does not affect the command&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$this -&amp;gt; error -&amp;gt; reset();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not reset the error a previous error will be reported even if the command was executed successfully this time.&lt;br /&gt;
&lt;br /&gt;
===== Getting the error message =====&lt;br /&gt;
If you just want to get the message that was defined when raising the error without the color formatting of $this -&amp;gt; error -&amp;gt; message() you can call the get-function like this&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$message = $this -&amp;gt; error -&amp;gt; get();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If no errors have been raised this will return an empty string.&lt;/div&gt;</summary>
		<author><name>B3b0tUzR</name></author>
	</entry>
</feed>