Class ExceptionMessage
This message is send whenever there is an exception during the execution of an Agent.
Implements
Inherited Members
Namespace: Agents.Net
Assembly: Agents.Net.dll
Syntax
public class ExceptionMessage : Message, IDisposable
Remarks
When there is a known error state in an Agent it should send the exception message directly because it is faster than throwing an exception and catching it again.
No one will handle these messages by default. That means, that the program will continue to be executed even after an exception occured. In order to change that behavior an Agent must be defined which handles these messages and decides when to stop the program. For that exceptions are captured with their respective
Constructors
| Improve this Doc View SourceExceptionMessage(ExceptionDispatchInfo, Message, Agent)
Initialized a new instance of the class ExceptionMessage with a captured exception.
Declaration
public ExceptionMessage(ExceptionDispatchInfo exceptionInfo, Message message, Agent agent)
Parameters
Type | Name | Description |
---|---|---|
ExceptionDispatchInfo | exceptionInfo | The captured exception info. |
Message | message | The predecessor message. |
Agent | agent | The agent that produced the exception. |
ExceptionMessage(ExceptionDispatchInfo, IEnumerable<Message>, Agent)
Initialized a new instance of the class ExceptionMessage with a captured exception.
Declaration
public ExceptionMessage(ExceptionDispatchInfo exceptionInfo, IEnumerable<Message> messages, Agent agent)
Parameters
Type | Name | Description |
---|---|---|
ExceptionDispatchInfo | exceptionInfo | The captured exception info. |
IEnumerable<Message> | messages | The predecessor messages. |
Agent | agent | The agent that produced the exception. |
ExceptionMessage(String, Message, Agent)
Initialized a new instance of the class ExceptionMessage with a custom message.
Declaration
public ExceptionMessage(string customMessage, Message message, Agent agent)
Parameters
Type | Name | Description |
---|---|---|
String | customMessage | The custom exception text. |
Message | message | The predecessor message. |
Agent | agent | The agent that produced the exception. |
ExceptionMessage(String, IEnumerable<Message>, Agent)
Initialized a new instance of the class ExceptionMessage with a custom message.
Declaration
public ExceptionMessage(string customMessage, IEnumerable<Message> messages, Agent agent)
Parameters
Type | Name | Description |
---|---|---|
String | customMessage | The custom exception text. |
IEnumerable<Message> | messages | The predecessor messages. |
Agent | agent | The agent that produced the exception. |
Properties
| Improve this Doc View SourceAgent
The agent which produced the exception.
Declaration
public Agent Agent { get; }
Property Value
Type | Description |
---|---|
Agent |
CustomMessage
Get the custom exception message.
Declaration
public string CustomMessage { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
When an exception is captured, this value is null
.
ExceptionInfo
Get the captured
Declaration
public ExceptionDispatchInfo ExceptionInfo { get; }
Property Value
Type | Description |
---|---|
ExceptionDispatchInfo |
Remarks
With that the exception can be recreated together with the stacktrace by calling
It can be null
, when the CustomMessage is used instead.
Methods
| Improve this Doc View SourceDataToString()
Overridden data method.
Declaration
protected override string DataToString()
Returns
Type | Description |
---|---|
String |
Overrides
Remarks
This is not used as exception messages are locked differently than normal messages.