<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407848</guid>
        <pubDate>Tue, 27 Oct 2009 18:18:48 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407848</link>
        <description><![CDATA[CodeMonkey: Для лога ошибок имеет смысл использовать хук на исключения. См. JCL, EurekaLog, madExcept. Помимо сообщения этот способ позволит получить стек вызовов и состояние процессора в момент ошибки. С этой информацией зачастую продиагностировать ошибку можно даже не запуская отладчик.]]></description>
        <author>CodeMonkey</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407781</guid>
        <pubDate>Tue, 27 Oct 2009 16:47:26 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407781</link>
        <description><![CDATA[Continental: С облегчением ...  :) <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Connected:=true;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;except</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on E : EIBInterBaseError do begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sShowMessage(IntToStr(e.IBErrorCode),E.Message);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
Спасибо всем, что открыли глаза. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-27T17:01:59+00:00">27.10.09, 17:01</time></span></span><br>
О&#33; вообще круто&#33; <strong class='tag-b'>CodeMonkey</strong>, спасибо что подсказали вот это <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">except</div><div class="code_line">&nbsp;&nbsp;on E: Exception do</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;if E is EIBDataBaseError then</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if EIBDataBaseError(E).ErrorCode = XXX then</div></ol></div></div></div></div><br>
Я теперь это заделал в applicationevents. Теперь у меня будет и лог вестись и сообщения об ошибках выводится&#33; Е-Е-Е&#33;]]></description>
        <author>Continental</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407780</guid>
        <pubDate>Tue, 27 Oct 2009 16:46:38 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407780</link>
        <description><![CDATA[mitrich: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=285634&view=findpost&p=2407761'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>CodeMonkey &#064; <time class="tag-quote__quoted-time" datetime="2009-10-27T16:11:08+00:00">27.10.09, 16:11</time></span><div class='quote '>Если у вашего EIBDataBaseError нет какого-нибудь IBErrorCode</div></div><br>
Именно так это свойство и называется, что нетрудно узнать из хелпа <em class='tag-i'>(который надеется на длительное и плодотворное сотрудничество с <strong class='tag-b'>Continental</strong> :) )</em><br>
Значения этих кодов прописаны в файле IBErrorCodes.pas (ищи его где-нибудь в C:&#092;Program Files&#092;Borland&#092;Delphi7&#092;Source&#092;Vcl&#092;IBErrorCodes.pas, к примеру)]]></description>
        <author>mitrich</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407761</guid>
        <pubDate>Tue, 27 Oct 2009 16:11:08 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407761</link>
        <description><![CDATA[CodeMonkey: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=285634&view=findpost&p=2407743'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Continental &#064; <time class="tag-quote__quoted-time" datetime="2009-10-27T15:51:35+00:00">27.10.09, 15:51</time></span><div class='quote '>Так вот я хочу сказать, что в двух случаях ошибки совсем разные, а вот класс исключения один и тот же. </div></div><br>
Если у вашего EIBDataBaseError нет какого-нибудь IBErrorCode - то это криво спроектированные классы Interbase.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=285634&view=findpost&p=2407743'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Continental &#064; <time class="tag-quote__quoted-time" datetime="2009-10-27T15:51:35+00:00">27.10.09, 15:51</time></span><div class='quote '>Так я не могу понять, как же мне отловить первую ошибку, или вторую вот с помощью такой конструкции:</div></div><br>
Если никакого поля с кодом нет, то по-хорошему - никак.<br>
<br>
(Т.е. вы можете, конечно, попробовать анализировать <em class='tag-i'>сообщение</em>, но ведь его могут локализовать). <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-27T16:13:13+00:00">27.10.09, 16:13</time></span></span><br>
P.P.S.<br>
Если же поле кода есть, то в общем случае как-то так:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">try</div><div class="code_line">&nbsp;&nbsp;IBDataBase.Connected:=true;</div><div class="code_line">except</div><div class="code_line">&nbsp;&nbsp;on E: EIBDataBaseError do</div><div class="code_line">&nbsp;&nbsp; &nbsp;if E.ErrorCode = XXX then</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;sShowMessage(&#39;несуществующий путь бд!&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp;end</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp;if E.ErrorCode = YYY then</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;sShowMessage(&#39;неверный пользователь или пароль&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp;end</div><div class="code_line">&nbsp;&nbsp; &nbsp;else </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;raise;</div><div class="code_line">end;</div></ol></div></div></div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-27T16:15:22+00:00">27.10.09, 16:15</time></span></span><br>
Или:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">try</div><div class="code_line">&nbsp;&nbsp;IBDataBase.Connected:=true;</div><div class="code_line">except</div><div class="code_line">&nbsp;&nbsp;on E: Exception do</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;if E is EIBDataBaseError then</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if EIBDataBaseError(E).ErrorCode = XXX then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sShowMessage(&#39;несуществующий путь бд!&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;end</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if EIBDataBaseError(E).ErrorCode = YYY then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sShowMessage(&#39;неверный пользователь или пароль&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;ShowMessage(e.ClassName,E.Message+&#39; совершенно другая ошибка&#39;);</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">end;</div></ol></div></div></div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-27T16:17:38+00:00">27.10.09, 16:17</time></span></span><br>
P.P.P.S. Но в общем и целом, если вам это нужно только для показа сообщения об ошибке &quot;на русском&quot;, то лучше бы вам локализовать константы вместо того, чтобы ставить кучу обработчиков по всей программе.]]></description>
        <author>CodeMonkey</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407743</guid>
        <pubDate>Tue, 27 Oct 2009 15:51:35 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407743</link>
        <description><![CDATA[Continental: ММММ.... всё равно прочитав всё, не могу реализовать то что я хочу.<br>
Вот к примеру:<br>
1. я указываю несуществующий путь к БД в TIBDataBase. Делаю подключение и try показывает ошибку класса <strong class='tag-b'>EIBDataBaseError</strong>, при этом вот такой текст ошибки: &#39;I&#092;O Error ....и т.д.&#39;.<br>
2. я указываю существующий путь к БД в TIBDataBase. Указываю неверный логин или верный логин, но неверный пароль и мне ошибка класса <strong class='tag-b'>EIBDataBaseError</strong>, но текст сообщения уже другой&#33; Текст такой: &#39;Your user name .... are not defined. ...&#39;. <br>
<br>
Так вот я хочу сказать, что в двух случаях ошибки совсем разные, а вот класс исключения один и тот же. <br>
Так я не могу понять, как же мне отловить первую ошибку, или вторую вот с помощью такой конструкции:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;IBDataBase.Connected:=true;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;except</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on E : что здесь должно быть, чтобы определить 1-й случай? do begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sShowMessage(&#39;несуществующий путь бд!&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on E : что здесь должно быть, чтобы определить 2-й случай? do begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sShowMessage(&#39;неверный пользователь или пароль&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on E : Exception do begin //люая другая ошибка</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sShowMessage(e.ClassName,E.Message+&#39; совершенно другая ошибка&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;</div></ol></div></div></div></div><br>
Помогите разобраться пожалуйста, я очень хочу сделать так, но не знаю.]]></description>
        <author>Continental</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407693</guid>
        <pubDate>Tue, 27 Oct 2009 14:59:11 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407693</link>
        <description><![CDATA[CodeMonkey: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=285634&view=findpost&p=2407667'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Continental &#064; <time class="tag-quote__quoted-time" datetime="2009-10-27T14:21:08+00:00">27.10.09, 14:21</time></span><div class='quote '>А вот в каком модуле находятся классы исключений при работе с ibx компонентами.</div></div><br>
Пуск/Поиск. *.pas с текстом EIBInterBaseError.<br>
Для ускорения поиска лучше ткнуть в папку Delphi.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=285634&view=findpost&p=2407667'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Continental &#064; <time class="tag-quote__quoted-time" datetime="2009-10-27T14:21:08+00:00">27.10.09, 14:21</time></span><div class='quote '>Вообще класс такой есть, он даже его показывает, если я делаю так</div></div><br>
Вместо<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">except</div><div class="code_line">&nbsp;&nbsp;on E: SomeClass do</div><div class="code_line">&nbsp;&nbsp;...</div></ol></div></div></div></div><br>
<br>
можно (но не рекомендуется) использовать:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">except</div><div class="code_line">&nbsp;&nbsp;on E: Exception do</div><div class="code_line">&nbsp;&nbsp; &nbsp;if E.ClassName = &#39;SomeClass&#39; then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;...</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;raise;</div></ol></div></div></div></div>]]></description>
        <author>CodeMonkey</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407689</guid>
        <pubDate>Tue, 27 Oct 2009 14:57:16 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407689</link>
        <description><![CDATA[mitrich: Хелп говорит, что <strong class='tag-b'>EIBInterBaseError</strong> находится в юните <strong class='tag-b'>IB</strong>]]></description>
        <author>mitrich</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407667</guid>
        <pubDate>Tue, 27 Oct 2009 14:21:08 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407667</link>
        <description><![CDATA[Continental: Спасибо за ссылку.<br>
А вот в каком модуле находятся классы исключений при работе с ibx компонентами.<br>
Т.е. мне надо вот к примеру такой класс исключения: <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">except</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on E: EIBInterBaseError do begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sShowMessage(e.ClassName,e.Message);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;</div></ol></div></div></div></div><br>
а он мне пишет: Неизвестная переменная <strong class='tag-b'>EIBInterBaseError</strong><br>
<br>
Вообще класс такой есть, он даже его показывает, если я делаю так:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Connected:=true;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;except</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on E: exception do</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sShowMessage(e.ClassName,e.Message);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;</div></ol></div></div></div></div><br>
Вот <strong class='tag-b'>e.ClassName</strong> как раз и есть <strong class='tag-b'>EIBInterBaseError</strong>, только я не могу класс коде указать.]]></description>
        <author>Continental</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407616</guid>
        <pubDate>Tue, 27 Oct 2009 12:52:11 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407616</link>
        <description><![CDATA[CodeMonkey: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">on E: EDivByZero do</div></ol></div></div></div></div><br>
<a class='tag-url' href='http://www.delphikingdom.ru/asp/viewitem.asp?catalogid=1392' target='_blank'>Подробно и в деталях</a>.]]></description>
        <author>CodeMonkey</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407606</guid>
        <pubDate>Tue, 27 Oct 2009 12:43:26 +0000</pubDate>
        <title>Как узнать код ошибки try except</title>
        <link>https://forum.sources.ru/index.php?showtopic=285634&amp;view=findpost&amp;p=2407606</link>
        <description><![CDATA[Continental: Подскажите, можно ли как нибудь отловить код ошибки?<br>
Объясняю на примере:<br>
Вот отлавливает деление на ноль, к примеру:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">//readln(A); &nbsp;=0;</div><div class="code_line">try</div><div class="code_line">Z:=Z/A;</div><div class="code_line">except on E: exception do</div><div class="code_line">ShowMessage(e.messages);</div><div class="code_line">end;</div></ol></div></div></div></div><br>
Ну это конечно ясно, что он напишет &#39;Division by zero&#39;, но это во-первых по английски, а во вторых, если мы напишем сразу сообщение по русски, т.е. так:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">//readln(A); &nbsp;=0;</div><div class="code_line">try</div><div class="code_line">Z:=Z/A;</div><div class="code_line">except</div><div class="code_line">ShowMessage(&#39;Деление на ноль!&#39;);</div><div class="code_line">end;</div></ol></div></div></div></div><br>
и допустим, что ошибка произошла не из-за того, что делится на ноль, а из-за чего-нибудь другова - то естественно сообщение будет ложным, а точнее неверным.<br>
И что делать? Типа есть такой вариант, но тупой:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">//readln(A); &nbsp;=0;</div><div class="code_line">try</div><div class="code_line">Z:=Z/A;</div><div class="code_line">except on E: exception do</div><div class="code_line">if (e.messages=&#39;Division by zero&#39;) then ShowMessage(&#39;Деление на ноль&#39;) else</div><div class="code_line">ShowMessage(e.messages);</div><div class="code_line">end;</div></ol></div></div></div></div><br>
Почему вариант тупой, да потому что, перед тем как вставить текст сообщения об ошибке надо:<br>
1. Сделать эту ошибку<br>
2. вывести её на экран<br>
3. скопировать её текст &quot;символ в символ&quot; <br>
4. потом вставить это сообщение в код для сравнения. <br>
<br>
Хочется что-то типа того, что текст ошибки сообщения мог бы заменять какой-нибудь её индетификатор, чтобы можно было типа такого:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">//readln(A); &nbsp;=0;</div><div class="code_line">try</div><div class="code_line">Z:=Z/A;</div><div class="code_line">except on E: exception do</div><div class="code_line">if (e.код_ошибки=123) then ShowMessage(&#39;Деление на ноль&#39;) else</div><div class="code_line">ShowMessage(e.messages);</div><div class="code_line">end;</div></ol></div></div></div></div><br>
где &quot;123&quot; есть индетификатор ошибки, т.е. заменяет сам текст &#39;Division by zero&#39;. Да, и у <strong class='tag-b'>e</strong> нет параметра на английском, что я написал на русском <strong class='tag-b'>код_ошибки</strong>. <br>
<br>
Ууууу.... Пока писал - сам устал.  :) <br>
Если кто поймёт меня, помогите разобраться.]]></description>
        <author>Continental</author>
        <category>Delphi: Общие вопросы</category>
      </item>
	
      </channel>
      </rss>
	