public virtual bool Error(ZIMapConnection connection, ZIMapException error)
 {   return false;   }
Beispiel #2
0
        /// <summary>
        /// Pass exception object to ZIMapConnection.Callback, throw as error is not handled. 
        /// </summary>
        /// <param name="conn">
        /// The parent connection or <c>null</c> if unknown.
        /// </param>
        /// <param name="code">
        /// The error code <see cref="ZIMapException.ErrorCode"/>
        /// </param>
        /// <param name="arg1">
        /// <c>null</c> for no info, an Exception object as inner exception or any other
        /// object (ToString will be called).
        /// </param>
        public static void Throw(ZIMapConnection conn, Error code, object arg1)
        {
            ZIMapException err;
            if(arg1 == null)
               err = new ZIMapException(code);
            else if(arg1 is Exception)
               err = new ZIMapException(code, (Exception)arg1);
            else
               err = new ZIMapException(code, MessageFromCode(code) + ": " + arg1.ToString());

            if(ZIMapConnection.Callback.Error(conn, err))
                return;
            throw err;
        }
Beispiel #3
0
 /// <summary>
 /// Report an error via callback and/or <see cref="ZIMapException"/>.
 /// </summary>
 /// <param name="code">
 /// The error code.
 /// </param>
 /// <param name="info">
 /// An additional description of the problem - can be of type
 /// Exception.
 /// </param>
 /// <remarks>
 /// If the info object is derived from the Exception class it is
 /// taken as 'inner exception'. For all other object types the
 /// result of ToString() is forwarded.
 /// </remarks>
 protected void RaiseError(ZIMapException.Error code, object info)
 {
     ZIMapConnection conn = parent as ZIMapConnection;
     ZIMapException.Throw(conn, code, info);
 }
Beispiel #4
0
 /// <summary>
 /// Report an error via callback and/or <see cref="ZIMapException"/>.
 /// </summary>
 /// <param name="code">
 /// The error code.
 /// </param>
 /// <remarks>
 /// Consider using another overload to pass additional error information.
 /// </remarks>
 protected void RaiseError(ZIMapException.Error code)
 {
     ZIMapConnection conn = parent as ZIMapConnection;
     ZIMapException.Throw(conn, code, null);
 }
Beispiel #5
0
 // kill program on exception ...
 public override bool Error(ZIMapConnection connection, ZIMapException error)
 {
     if(Thread.CurrentThread.ThreadState == ThreadState.AbortRequested)
         return true;
     ZIMapAdmin.Error("Error [exception]: {0}", error.Message);
     if(!Executing)
     {   if(LineTool.LogWriter != null) LineTool.LogWriter.Close();
         ZIMapAdmin.Error("Terminating the program");
         System.Environment.Exit(2);
     }
     if(Debug == 0) LineTool.Info(
         "Ignoring the error. Use the 'debug 2' command to enable debug output.");
     return false;
 }