/
UnexpectedlyTerminatedActionException.cs
75 lines (70 loc) · 3.14 KB
/
UnexpectedlyTerminatedActionException.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Security.Cryptography;
using Libplanet.Blockchain.Policies;
using Libplanet.Blocks;
using Libplanet.Tx;
namespace Libplanet.Action
{
/// <summary>
/// The exception that is thrown during an <see cref="IAction"/> is being evaluated.
/// <para>The actual exception that the <see cref="Action"/> threw
/// is stored in the <see cref="Exception.InnerException"/> property.</para>
/// </summary>
[Serializable]
public sealed class UnexpectedlyTerminatedActionException : Exception
{
/// <summary>
/// Creates a new <see cref="UnexpectedlyTerminatedActionException"/> object.
/// </summary>
/// <param name="blockHash">The <see cref="Block{T}.Hash"/> of the <see cref="Block{T}"/>
/// that <paramref name="action"/> belongs to. This can be <c>null</c> on rehearsal mode.
/// </param>
/// <param name="blockIndex">The <see cref="Block{T}.Index"/> of the <see cref="Block{T}"/>
/// that <paramref name="action"/> belongs to. This can be <c>null</c> on rehearsal mode.
/// </param>
/// <param name="txid">The <see cref="Transaction{T}.Id"/> of
/// the <see cref="Transaction{T}"/> that <paramref name="action"/> belongs to.
/// This can be <c>null</c> on rehearsal mode or if <paramref name="action"/> is
/// a <see cref="IBlockPolicy{T}.BlockAction"/>.
/// </param>
/// <param name="action">The <see cref="IAction"/> object which threw an exception.</param>
/// <param name="message">Specifies a <see cref="Exception.Message"/>.</param>
/// <param name="innerException">The actual exception that the <see cref="Action"/> threw.
/// </param>
public UnexpectedlyTerminatedActionException(
HashDigest<SHA256>? blockHash,
long? blockIndex,
TxId? txid,
IAction action,
string message,
Exception innerException
)
: base(message, innerException)
{
BlockHash = blockHash;
BlockIndex = blockIndex;
TxId = txid;
Action = action;
}
/// <summary>
/// The <see cref="Block{T}.Hash"/> of the <see cref="Block{T}"/> that <see cref="Action"/>
/// belongs to. This can be <c>null</c> on rehearsal mode.
/// </summary>
public HashDigest<SHA256>? BlockHash { get; }
/// <summary>
/// The <see cref="Block{T}.Index"/> of the <see cref="Block{T}"/> that <see cref="Action"/>
/// belongs to. This can be <c>null</c> on rehearsal mode.
/// </summary>
public long? BlockIndex { get; }
/// <summary>
/// The <see cref="Transaction{T}.Id"/> of the <see cref="Transaction{T}"/> that
/// <see cref="Action"/> belongs to. This can be <c>null</c> on rehearsal mode or
/// if <see cref="Action"/> is a <see cref="IBlockPolicy{T}.BlockAction"/>.
/// </summary>
public TxId? TxId { get; }
/// <summary>
/// The <see cref="IAction"/> object which threw an exception.
/// </summary>
public IAction Action { get; }
}
}