Exception handling

The .NET SDK contains the TenTenException class.

The TenTenException class can be caught with try/catch. The TenTenException class is the parent class of all of the 1010data .NET SDK exceptions. The following example uses try/catch for exception handling:
using System;
using System.Linq;
using TenTenSDK;

namespace ColumnPrinter {
    
    public static class TestProgram {
        public static void PrintTable(Session s, String path, String ops) {
            var q = new Query(path, ops);
            using(Table t = q.RunOn(s)) {
                foreach(Column c in t.Columns) {
                    Console.WriteLine("Column {0} ({1})", c.Info.Title,
                                      c.Info.Name);
                    Console.WriteLine("\t" +
                                      String.Join<String>(", ", c.AsStrings));
                }
            }
        }
        
        public static void Main(String[] args) {
            Uri gateway = new Uri("https://www2.1010data.com/cgi-bin/gw.k");
            String user = "[USERNAME]";
            String pwd = "[PASSWORD]";
            String table = "pub.demo.weather.stations";
            String ops = "<sel value=""(i_<100)""/>";
            try {
                using(Session s = new Session(gateway, user, pwd,
                                              LoginType.POSSESS)) {
                    PrintTable(s, table, ops);
                }
            }
            catch (TenTenSDK.Exceptions.TenTenException exc) {
                Console.Error.WriteLine("1010 Exception occurred: " +
                                        exc.ToString());
            }
            Console.Write("Press Enter to finish");
        }
    }
}