// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
namespace FlaxEngine.Assertions
{
///
/// An exception that is thrown on a failure. To enable this feature needs to be set to true.
///
[HideInEditor]
public class AssertionException : Exception
{
private string _userMessage;
///
public override string Message
{
get
{
string message = base.Message;
if (_userMessage != null)
message = string.Concat(message, '\n', _userMessage);
return message;
}
}
///
/// Initializes a new instance of the class.
///
public AssertionException()
: this(string.Empty, string.Empty)
{
}
///
/// Initializes a new instance of the class.
///
/// The user message.
public AssertionException(string userMessage)
: this("Assertion failed!", userMessage)
{
}
///
/// Initializes a new instance of the class.
///
/// The message.
/// The user message.
public AssertionException(string message, string userMessage)
: base(message)
{
_userMessage = userMessage;
}
}
}