PostSharp SDK 6.10 / / Class Reference / Post­Sharp.​Sdk.​Code­Model Namespace / Instruction­Block Class / Instruction­Block Methods / Instruction­Block.​Add­Exception­Handler­Catch Method

InstructionBlock.AddExceptionHandlerCatch Method

Constructs an catchExceptionHandler and add it to the current block.

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 6.10.14.0 (6.10.14.0)
Syntax
C#
public ExceptionHandler AddExceptionHandlerCatch(
	ITypeSignature catchType,
	InstructionBlock handlerBlock,
	NodePosition position = NodePosition.After,
	ExceptionHandler referenceHandler = null
)

Parameters

catchType
Type: PostSharp.Sdk.CodeModel.ITypeSignature
Type caught.
handlerBlock
Type: PostSharp.Sdk.CodeModel.InstructionBlock
Handler block.
position (Optional)
Type: NodePosition
Position of the new ExceptionHandler w.r.t. referenceHandler.
referenceHandler (Optional)
Type: PostSharp.Sdk.CodeModel.ExceptionHandler
Handler before or after which the new handler has to be inserted, or null if the new handler has to be the first or the last.

Return Value

Type: ExceptionHandler
The new ExceptionHandler.
Exceptions
ExceptionCondition
ArgumentNullExceptionhandlerBlock is null.
ArgumentNullExceptioncatchType is null.
InvalidOperationException The current block is detached or is the root.
ArgumentExceptionhandlerBlock is attached.
See Also