<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Warum wird mit catch(...) nicht jede Exception abgefangen?]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>im Konstruktor einer Klasse wird eine Exception (ein int mit Wert -1) geworfen wenn der übergebene Paramter aus dem Rahmen fällt. Dies ist der Code mit dem ich die Exception auffangen will:</p>
<pre><code class="language-cpp">try {
	oMyObj = new MyClass(10);
} catch (...) {
	oMyObj=0; // Sehen ob der Debugger hier lang kommt.
}
</code></pre>
<p>Ich sehe wie der Debugger in den Try Block reingeht und wenn ich die New Anweisung ausführe bekomme ich die Fehlermeldung Unhandled Exception und dieses im Debug Fenster:</p>
<blockquote>
<p>First-chance exception in ProjectX.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.<br />
First-chance exception in ProjectX.exe (MSVCRT.DLL): 0xC0000005: Access Violation.</p>
</blockquote>
<p>Wenn ich innerhalb des Konstruktors von MyClass debugge komme ich zur &quot;throw -1&quot; Anweisung... und kriege wieder die Unhandled Exception Meldung.</p>
<p>Wenn ich ein Beispielprojekt erstelle wo ein Konstruktor eine Exception wirft, wird diese in obiger catch Bedingung gefangen. Nur hier nicht... habt Ihr einen Tip für mich?</p>
<p>Vielen Dank</p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/190612/warum-wird-mit-catch-nicht-jede-exception-abgefangen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 17:01:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/190612.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 24 Aug 2007 13:42:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Warum wird mit catch(...) nicht jede Exception abgefangen? on Fri, 24 Aug 2007 13:42:33 GMT]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>im Konstruktor einer Klasse wird eine Exception (ein int mit Wert -1) geworfen wenn der übergebene Paramter aus dem Rahmen fällt. Dies ist der Code mit dem ich die Exception auffangen will:</p>
<pre><code class="language-cpp">try {
	oMyObj = new MyClass(10);
} catch (...) {
	oMyObj=0; // Sehen ob der Debugger hier lang kommt.
}
</code></pre>
<p>Ich sehe wie der Debugger in den Try Block reingeht und wenn ich die New Anweisung ausführe bekomme ich die Fehlermeldung Unhandled Exception und dieses im Debug Fenster:</p>
<blockquote>
<p>First-chance exception in ProjectX.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.<br />
First-chance exception in ProjectX.exe (MSVCRT.DLL): 0xC0000005: Access Violation.</p>
</blockquote>
<p>Wenn ich innerhalb des Konstruktors von MyClass debugge komme ich zur &quot;throw -1&quot; Anweisung... und kriege wieder die Unhandled Exception Meldung.</p>
<p>Wenn ich ein Beispielprojekt erstelle wo ein Konstruktor eine Exception wirft, wird diese in obiger catch Bedingung gefangen. Nur hier nicht... habt Ihr einen Tip für mich?</p>
<p>Vielen Dank</p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1351205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1351205</guid><dc:creator><![CDATA[martin_salo]]></dc:creator><pubDate>Fri, 24 Aug 2007 13:42:33 GMT</pubDate></item><item><title><![CDATA[Reply to Warum wird mit catch(...) nicht jede Exception abgefangen? on Fri, 24 Aug 2007 13:58:28 GMT]]></title><description><![CDATA[<p>Hardwareexceptions werden nicht gefangen.</p>
<p>MfG<br />
<img src="https://static.c-plusplus.net/magazine/images/forumtreff/gruppenbild.jpg" alt="" class="img-responsive img-markdown" /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1351218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1351218</guid><dc:creator><![CDATA[Berater Team]]></dc:creator><pubDate>Fri, 24 Aug 2007 13:58:28 GMT</pubDate></item><item><title><![CDATA[Reply to Warum wird mit catch(...) nicht jede Exception abgefangen? on Fri, 24 Aug 2007 14:11:13 GMT]]></title><description><![CDATA[<p>Wieso Hardware Exception?<br />
Mein Konstruktor sieht mitlerweile so aus:</p>
<pre><code class="language-cpp">MyClass::MyClass {
throw -1;
}
</code></pre>
<p>Wenn ich ein Objekt MyClass erstelle wird die Exception nicht in catch(...) abgefangen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1351229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1351229</guid><dc:creator><![CDATA[martin_salo]]></dc:creator><pubDate>Fri, 24 Aug 2007 14:11:13 GMT</pubDate></item><item><title><![CDATA[Reply to Warum wird mit catch(...) nicht jede Exception abgefangen? on Fri, 24 Aug 2007 14:54:51 GMT]]></title><description><![CDATA[<p>Ich vermute es hängt mit dem Visual Studio zusammen:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-190622.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-190622.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1351262</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1351262</guid><dc:creator><![CDATA[martin_salo]]></dc:creator><pubDate>Fri, 24 Aug 2007 14:54:51 GMT</pubDate></item></channel></rss>