Example #1
0
        public static void GetLastErrorInfo(ref FPErrorInfo outErrorInfo)
        {
            unsafe
            {
                var ptr = (IntPtr)Marshal.AllocHGlobal((int)1024).ToPointer();

                /* Get the error message of the last SDK API function call */
                SDK.FPPool_GetLastErrorInfo(ptr);
                outErrorInfo = (FPErrorInfo)Marshal.PtrToStructure(ptr, typeof(FPErrorInfo));
                Marshal.FreeHGlobal(ptr);
            }

            SDK.CheckAndThrowError();
        }
Example #2
0
        /// <summary>
        /// Generic error checking routine for transforming SDK errors into .NET exceptions
        /// </summary>
        public static void CheckAndThrowError()
        {
            /* Get the error code of the last SDK API function call */
            var errorCode = SDK.FPPool_GetLastError();

            if (0 != errorCode)
            {
                var errInfo = new FPErrorInfo();

                unsafe
                {
                    var ptr = (IntPtr)Marshal.AllocHGlobal((int)1024).ToPointer();

                    /* Get the error message of the last SDK API function call */
                    SDK.FPPool_GetLastErrorInfo(ptr);
                    errInfo = (FPErrorInfo)Marshal.PtrToStructure(ptr, typeof(FPErrorInfo));
                    Marshal.FreeHGlobal(ptr);
                }

                throw new FPLibraryException(errInfo);
            }
        }
Example #3
0
 internal ErrorInfo(FPErrorInfo errorInfo) => this.errorInfo = errorInfo;
Example #4
0
 internal ErrorInfo(FPErrorInfo errorInfo)
 {
     _errorInfo = errorInfo;
 }