Beispiel #1
0
        public void OnRfcServerError(Object server, RfcServerErrorEventArgs errorEventData)
        {
            RfcServer rfcServer = server as RfcServer;
            RfcServerApplicationException appEx = errorEventData.Error as RfcServerApplicationException;

            if (appEx != null)
            {
                Console.WriteLine("RfcServerApplicationError occured in RFC server {0} :", rfcServer.Name);
            }
            else
            {
                Console.WriteLine("RfcServerError occured in RFC server {0} :", rfcServer.Name);
            }


            if (errorEventData.ServerContextInfo != null)
            {
                Console.WriteLine("RFC Caller System ID: {0} ", errorEventData.ServerContextInfo.SystemAttributes.SystemID);
                Console.WriteLine("RFC function Name: {0} ", errorEventData.ServerContextInfo.FunctionName);
            }

            Console.WriteLine("Error type: {0}", errorEventData.Error.GetType().Name);
            Console.WriteLine("Error message: {0}", errorEventData.Error.Message);

            if (appEx != null)
            {
                Console.WriteLine("Inner exception type: {0}", appEx.InnerException.GetType().Name);
                Console.WriteLine("Inner exception message: {0}", appEx.InnerException.Message);
            }
        }
Beispiel #2
0
        //
        // This method is used as the event handler for application errors raised while a server processes a requested function.
        // As opposed to internal errors these errors occur in application coding outside NCO3. Note that the application can throw
        // whichever type of exception it sees fit. It will be wrapped in a RfcServerApplicationException and made available as its
        // inner exception.
        //
        private static void OnRfcServerApplicationError(Object server, RfcServerErrorEventArgs errorEventData)
        {
            RfcServer rfcServer = server as RfcServer;

            Console.WriteLine();
            Console.WriteLine(">>>>> RfcServerApplicationError occurred in RFC server {0}:", rfcServer.Name);
            ShowErrorEventData(errorEventData);
            RfcServerApplicationException appEx = errorEventData.Error as RfcServerApplicationException;

            if (appEx != null)
            {
                Console.WriteLine("Inner exception type: {0}", appEx.InnerException.GetType().Name);
                Console.WriteLine("Inner exception message: {0}", appEx.InnerException.Message);
            }
            else
            {
                Console.WriteLine("WARNING: errorEventData.Error is not an instance of RfcServerApplicationError");
            }
        }