Commit be104eac authored by Megax's avatar Megax
Browse files

* Exceptions mappa letrehozva.

parent 07842806
......@@ -26,7 +26,7 @@
using System;
using System.Runtime.Serialization;
namespace LuaInterface
namespace LuaInterface.Exceptions
{
/// <summary>
/// Exceptions thrown by the Lua runtime
......
......@@ -25,51 +25,50 @@
using System;
namespace LuaInterface
namespace LuaInterface.Exceptions
{
/// <summary>
/// Exceptions thrown by the Lua runtime because of errors in the script
/// </summary>
public class LuaScriptException : LuaException
{
/// <summary>
/// Returns true if the exception has occured as the result of a .NET exception in user code
/// </summary>
public bool IsNetException { get; private set; }
/// <summary>
/// Exceptions thrown by the Lua runtime because of errors in the script
/// </summary>
public class LuaScriptException : LuaException
{
/// <summary>
/// Returns true if the exception has occured as the result of a .NET exception in user code
/// </summary>
public bool IsNetException { get; private set; }
private readonly string source;
private readonly string source;
/// <summary>
/// The position in the script where the exception was triggered.
/// </summary>
public override string Source { get { return source; } }
/// <summary>
/// The position in the script where the exception was triggered.
/// </summary>
public override string Source { get { return source; } }
/// <summary>
/// Creates a new Lua-only exception.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="source">The position in the script where the exception was triggered.</param>
public LuaScriptException(string message, string source) : base(message)
{
this.source = source;
}
/// <summary>
/// Creates a new Lua-only exception.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="source">The position in the script where the exception was triggered.</param>
public LuaScriptException(string message, string source) : base(message)
{
this.source = source;
}
/// <summary>
/// Creates a new .NET wrapping exception.
/// </summary>
/// <param name="innerException">The .NET exception triggered by user-code.</param>
/// <param name="source">The position in the script where the exception was triggered.</param>
public LuaScriptException(Exception innerException, string source)
/// <summary>
/// Creates a new .NET wrapping exception.
/// </summary>
/// <param name="innerException">The .NET exception triggered by user-code.</param>
/// <param name="source">The position in the script where the exception was triggered.</param>
public LuaScriptException(Exception innerException, string source)
: base("A .NET exception occured in user-code", innerException)
{
this.source = source;
this.IsNetException = true;
}
{
this.source = source;
this.IsNetException = true;
}
public override string ToString()
{
// Prepend the error source
return GetType().FullName + ": " + source + Message;
}
}
public override string ToString()
{
// Prepend the error source
return GetType().FullName + ": " + source + Message;
}
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using LuaInterface.Event;
using LuaInterface.Exceptions;
namespace LuaInterface
{
......
......@@ -37,7 +37,6 @@
<ItemGroup>
<Compile Include="CheckType.cs" />
<Compile Include="Lua.cs" />
<Compile Include="LuaException.cs" />
<Compile Include="Metatables.cs" />
<Compile Include="MethodWrapper.cs" />
<Compile Include="ObjectTranslator.cs" />
......@@ -49,7 +48,6 @@
<Compile Include="LuaGlobalAttribute.cs" />
<Compile Include="LuaHideAttribute.cs" />
<Compile Include="LuaRegistrationHelper.cs" />
<Compile Include="LuaScriptException.cs" />
<Compile Include="LuaTable.cs" />
<Compile Include="LuaUserData.cs" />
<Compile Include="Extensions\GeneralExtensions.cs" />
......@@ -63,6 +61,8 @@
<Compile Include="Event\LuaDebug.cs" />
<Compile Include="Event\DebugHookEventArgs.cs" />
<Compile Include="Event\HookExceptionEventArgs.cs" />
<Compile Include="Exceptions\LuaException.cs" />
<Compile Include="Exceptions\LuaScriptException.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
......@@ -82,5 +82,6 @@
<Folder Include="Extensions\" />
<Folder Include="GenerateEventAssembly\" />
<Folder Include="Event\" />
<Folder Include="Exceptions\" />
</ItemGroup>
</Project>
......@@ -25,10 +25,11 @@
using System;
using System.IO;
using System.Collections;
using System.Reflection;
using System.Collections.Generic;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using LuaInterface.Exceptions;
namespace LuaInterface
{
......
......@@ -25,10 +25,11 @@
using System;
using System.IO;
using System.Collections;
using System.Reflection;
using System.Collections.Generic;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using LuaInterface.Exceptions;
namespace LuaInterface
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment