This commit is contained in:
Jelle Luteijn 2022-05-15 11:19:49 +02:00
parent 16e76d6b31
commit 484dbfc9d9
529 changed files with 113694 additions and 0 deletions

View file

@ -0,0 +1,61 @@
using System;
using System.Runtime.Remoting;
using System.Security.Permissions;
using AspClassic.Scripting.Runtime;
using AspClassic.Scripting.Utils;
namespace AspClassic.Scripting.Hosting;
public sealed class ExceptionOperations : MarshalByRefObject
{
private readonly LanguageContext _context;
internal ExceptionOperations(LanguageContext context)
{
_context = context;
}
public string FormatException(Exception exception)
{
return _context.FormatException(exception);
}
public void GetExceptionMessage(Exception exception, out string message, out string errorTypeName)
{
_context.GetExceptionMessage(exception, out message, out errorTypeName);
}
public bool HandleException(Exception exception)
{
ContractUtils.RequiresNotNull(exception, "exception");
return false;
}
public string FormatException(ObjectHandle exception)
{
Exception ex = exception.Unwrap() as Exception;
ContractUtils.Requires(ex != null, "exception", "ObjectHandle must be to Exception object");
return _context.FormatException(ex);
}
public void GetExceptionMessage(ObjectHandle exception, out string message, out string errorTypeName)
{
Exception ex = exception.Unwrap() as Exception;
ContractUtils.Requires(ex != null, "exception", "ObjectHandle must be to Exception object");
_context.GetExceptionMessage(ex, out message, out errorTypeName);
}
public bool HandleException(ObjectHandle exception)
{
Exception ex = exception.Unwrap() as Exception;
ContractUtils.Requires(ex != null, "exception", "ObjectHandle must be to Exception object");
ContractUtils.RequiresNotNull(ex, "exception");
return false;
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public override object InitializeLifetimeService()
{
return null;
}
}