26 lines
560 B
C#
26 lines
560 B
C#
public struct PersistError
|
|
{
|
|
public PersistCode Code;
|
|
public string Description;
|
|
public long Bytes;
|
|
|
|
public static implicit operator PersistCode(PersistError err)
|
|
{
|
|
return err.Code;
|
|
}
|
|
|
|
public static implicit operator int(PersistError err)
|
|
{
|
|
return (int) err.Code;
|
|
}
|
|
|
|
public bool IsOk()
|
|
{
|
|
return Code == 0;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Code + (Code != PersistCode.OK ? "(" + Description + ")" : ", " + Bytes + " bytes");
|
|
}
|
|
} |