<?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[пример try/catch]]></title><description><![CDATA[<p dir="auto">Гулял по форуму и  нашел, что в версии 1.2.16 добавлен оператор try / catch</p>
<p dir="auto"><a href="/post/14616">https://www.netxms.org/forum/announcements/netxms-1-2-16-released/msg14616/#msg14616</a></p>
<p dir="auto">Как пользоваться им ума не приложу. Может кто поделится рабочим примером?</p>
]]></description><link>https://forum.netxms.org/topic/3789/пример-try-catch</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 13:10:23 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/3789.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 May 2015 08:04:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to пример try/catch on Wed, 27 May 2015 05:31:53 GMT]]></title><description><![CDATA[<p dir="auto">Спасибо</p>
]]></description><link>https://forum.netxms.org/post/16965</link><guid isPermaLink="true">https://forum.netxms.org/post/16965</guid><dc:creator><![CDATA[seaman]]></dc:creator><pubDate>Wed, 27 May 2015 05:31:53 GMT</pubDate></item><item><title><![CDATA[Reply to пример try/catch on Tue, 26 May 2015 14:31:01 GMT]]></title><description><![CDATA[<p dir="auto">Например такой скрипт:</p>
<pre><code>x = 1;
y = null;

z = x / y;

println "z=" . z;
</code></pre>
<p dir="auto">завершится с ошибкой:</p>
<pre><code>Error 5 in line 4: Invalid operation with NULL value
</code></pre>
<p dir="auto">добавляем try/catch:</p>
<pre><code>x = 1;
y = null;

try
{
   z = x / y;
}
catch
{
   z = "ERROR CODE=" . $errorcode . "; LINE=" . $errorline . "; TEXT=" . $errortext;
}

println "z=" . z;
</code></pre>
<p dir="auto">Скрипт отработает и выдаст</p>
<pre><code>C:\Source\NetXMS\x64\debug&gt;nxscript.exe test20.nxsl
NetXMS Scripting Host  Version 2.0-M5
Copyright (c) 2005-2015 Victor Kirhenshtein

z=ERROR CODE=5; LINE=6; TEXT=Error 5 in line 6: Invalid operation with NULL value

C:\Source\NetXMS\x64\debug&gt;
</code></pre>
]]></description><link>https://forum.netxms.org/post/16955</link><guid isPermaLink="true">https://forum.netxms.org/post/16955</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 26 May 2015 14:31:01 GMT</pubDate></item></channel></rss>