Where to find all possible errors in MySQLi
<p>I want to create a custom error system in MySQLi, for this I will need a list with all error codes and a description on why they are being caused.</p>

<p>I have searched all over the web but can't find anything on <a href="http://php.net" rel="nofollow noreferrer">php.net</a></p>

<hr>

<p>For example if I create a new object where the host is invalid:</p>

<pre><code>$mysqli = new mysqli('invalid_host', 'root', '', 'db');
</code></pre>

<p>then the error code will be <code>2002</code> which means it could not find the adress.</p>

<p>The original error looks like:</p>

<blockquote>
  <p>php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known</p>
</blockquote>

<p>But I would want it to display:</p>

<blockquote>
  <p><b>Connection error!</b> There was an problem connecting to the database, this is caused by your invalid hostname: "invalid_host" which seems to not be connectable or pingable! (2002)</p>
</blockquote>

<hr>

<p>In order to do that I will need to know all the errors that can occure in MySQLi, I haven't found a list yet so I am asking here if you know about a list</p>

<hr>

<p>If you wonder how I'm going to do it I am planning to have an array which will contain of:</p>

<pre><code>$error_list = [
    2002 =&gt; [
        'category' =&gt; 'connection_errors',
        'error_title' =&gt; 'Connection error!',
        'error_content' =&gt; 'There was an problem connecting to the database, this is caused by your invalid hostname: "invalid_host" which seems to not be connectable or pingable!',
        'error_code' =&gt; '2002',
        'error_description' =&gt; 'This error is occurred by invalid hostname. Why is this error occurring? It is occurring because you have entered invalid hostname, such as: "msql. example .com"'
    ]

    // And so on
];
</code></pre>

<hr>

<p>I'd be really happy if anyone know where to find such a list, this project will be shared in the future, and when it's finished I'll add an comment with an link.</p>

<hr>

<p>The project can also make easier and safer (prepared) queries to an MySQL server, with MySQLi.</p>