LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeScripting

A forum for information about scripting with CastleOS. Get samples, suggestions, and other help here

Error handling Messages in this topic - RSS

Scott Goffman
Scott Goffman
Posts: 111


11/14/2016
Scott Goffman
Scott Goffman
Posts: 111
It's been a while since I've done any CastleOS scripting, but I'm pretty sure that I used to be able to use Try/Catch statements for error handling (and getting useful debugging info). But in the latest Core Service betas, Try/Catch doesn't seem to work anymore; if there's any error in a script, it just silently fails.

For example, this simple test script:

using System;
using CastleOSCoreService;
using System.Diagnostics;
using System.Net;

public class TestScript
{
public void Main(string[] args)
{
try
{
ThisIsNotARealFunction();

}
catch (Exception e)
{
File.WriteAllText("C:\\ScriptError.txt", e.ToString());
}
}
}


Should throw a NullRef exception to the text file, but nothing is output. Did something change? Is there a better way to catch script errors?

(I also tried outputting errors to the System EventLog, but same lack of results now.)


-Scott
0 link