пример try/catch
-
Гулял по форуму и нашел, что в версии 1.2.16 добавлен оператор try / catch
https://www.netxms.org/forum/announcements/netxms-1-2-16-released/msg14616/#msg14616
Как пользоваться им ума не приложу. Может кто поделится рабочим примером?
-
Например такой скрипт:
x = 1; y = null; z = x / y; println "z=" . z;завершится с ошибкой:
Error 5 in line 4: Invalid operation with NULL valueдобавляем try/catch:
x = 1; y = null; try { z = x / y; } catch { z = "ERROR CODE=" . $errorcode . "; LINE=" . $errorline . "; TEXT=" . $errortext; } println "z=" . z;Скрипт отработает и выдаст
C:\Source\NetXMS\x64\debug>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> -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login