using System;
using NetVips.Internal;
namespace NetVips;
///
/// Our own exception class which handles the libvips error buffer.
///
public class VipsException : Exception
{
///
/// Initializes a new instance of the class.
///
public VipsException()
{
}
///
/// Initializes a new instance of the class with a specified error message.
///
/// The message that describes the error.
public VipsException(string message)
: base($"{message}{Environment.NewLine}{VipsErrorBuffer()}")
{
Vips.ErrorClear();
}
///
/// Initializes a new instance of the class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
///
/// The error message that explains the reason for the exception.
/// The exception that is the cause of the current exception, or a null reference if no inner exception is specified.
public VipsException(string message, Exception inner)
: base($"{message}{Environment.NewLine}{VipsErrorBuffer()}", inner)
{
Vips.ErrorClear();
}
private static string VipsErrorBuffer()
{
return Vips.ErrorBuffer().ToUtf8String();
}
}