Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share common base class for exceptions #679

Merged
merged 1 commit into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jint/Runtime/JavaScriptException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Jint.Runtime
{
public class JavaScriptException : Exception
public class JavaScriptException : JintException
{
private string _callStack;

Expand Down
28 changes: 28 additions & 0 deletions Jint/Runtime/JintException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Runtime.Serialization;

namespace Jint.Runtime
{
/// <summary>
/// Base class for exceptions thrown by Jint.
/// </summary>
[Serializable]
public abstract class JintException : Exception
{
protected JintException()
{
}

protected JintException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}

protected JintException(string message) : base(message)
{
}

protected JintException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
6 changes: 2 additions & 4 deletions Jint/Runtime/MemoryLimitExceededException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;

namespace Jint.Runtime
namespace Jint.Runtime
{
public class MemoryLimitExceededException : Exception
public class MemoryLimitExceededException : JintException
{
public MemoryLimitExceededException() : base()
{
Expand Down
6 changes: 2 additions & 4 deletions Jint/Runtime/RangeErrorException.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;

namespace Jint.Runtime
namespace Jint.Runtime
{
/// <summary>
/// Workaround for situation where engine is not easily accessible.
/// </summary>
internal sealed class RangeErrorException : Exception
internal sealed class RangeErrorException : JintException
{
public RangeErrorException(string message) : base(message)
{
Expand Down
6 changes: 2 additions & 4 deletions Jint/Runtime/RecursionDepthOverflowException.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using Jint.Runtime.CallStack;

namespace Jint.Runtime
{
using Jint.Runtime.CallStack;

public class RecursionDepthOverflowException : Exception
public class RecursionDepthOverflowException : JintException
{
public string CallChain { get; private set; }

Expand Down
6 changes: 2 additions & 4 deletions Jint/Runtime/StatementsCountOverflowException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;

namespace Jint.Runtime
namespace Jint.Runtime
{
public class StatementsCountOverflowException : Exception
public class StatementsCountOverflowException : JintException
{
public StatementsCountOverflowException() : base("The maximum number of statements executed have been reached.")
{
Expand Down
6 changes: 2 additions & 4 deletions Jint/Runtime/TypeErrorException.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;

namespace Jint.Runtime
namespace Jint.Runtime
{
/// <summary>
/// Workaround for situation where engine is not easily accessible.
/// </summary>
internal sealed class TypeErrorException : Exception
internal sealed class TypeErrorException : JintException
{
public TypeErrorException(string message) : base(message)
{
Expand Down