Catch an pre-defined int exception
<p>I have defined a simple int error code:</p>

<pre><code>#define my_error 20
</code></pre>

<p>Somewhere in my code i throw this error:</p>

<pre><code>throw my_error;
</code></pre>

<p>Now i want to try and catch this exception thrown:</p>

<pre><code>try
{
    ...
    ...
}
catch (my_error)
{
    cout &lt;&lt; "Error: my error";
}
</code></pre>

<p>Unfortunately the compiler doesn't approve this:</p>

<ul>
<li>syntax error : 'constant'</li>
<li>catch handlers must specify one type</li>
<li>'try' block starting on line '34' has no catch handlers</li>
</ul>

<p>Is there a way to do this ? </p>

<p>Thanks.</p>
