/** * <summary> * Throws an exception if the ZraStatusCode within the ZraStatus structure is not success. * </summary> * <param name="zraStatus">The ZraStatus structure to check</param> */ public static void ThrowIfError(this ZraStatus zraStatus) { if (zraStatus.ZraStatusCode == ZraStatusCode.Success) { return; } IntPtr errorStringPtr = LibZra.ZraGetErrorString(zraStatus); throw new ZraException(zraStatus, Marshal.PtrToStringUTF8(errorStringPtr)); }
/** * <param name="status">The status structure that should be described</param> * <returns>A pointer to a string describing the error corresponding to the code supplied.</returns> */ [DllImport("libzra")] public static extern IntPtr ZraGetErrorString(ZraStatus status);