Commit be104eac authored by Megax's avatar Megax
Browse files

* Exceptions mappa letrehozva.

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