ASN1C C# Runtime Library  7.8
Public Member Functions | List of all members
Asn1BerExceptionHandler Interface Reference

Public Member Functions

System.Exception HandleException (Asn1Exception e, Asn1BerDecodeBuffer buffer)
 

Detailed Description

Asn1BerExceptionHandler defines the interface users implement if they want to be notified of errors durnig decoding and have the opportunity to prevent an exception from being thrown. /p>

Member Function Documentation

◆ HandleException()

System.Exception HandleException ( Asn1Exception  e,
Asn1BerDecodeBuffer  buffer 
)

This method is invoked by generated code before throwing certain exceptions.

If the method returns an exception, that exception will be thrown. Otherwise, if null is returned, the exception will not be thrown. /p> It is always safe to simply return the received exception, e. When returning null, the function is responsible for having performed the required corrective action in order to allow the calling code to resume decoding. The right corrective action will depend on the error condition, as described below. p> ul> li> Asn1InvalidEnumException
Asn1MissingRequiredException: No corrective action is required. Simply return null to ignore the exception. /li> li> Asn1InvalidChoiceOptionException Asn1NotInSetException
Asn1SeqOrderException
Asn1SetDuplicateException
Asn1UnexpectedElementException: If returning null, you must consume the current TLV from the input. /li> /ul>

Parameters
eThe exception the caller wishes to throw, indicating what error occurred.
bufferThe decode buffer.
Returns
The exception you want to have thrown, including null for none.

Referenced by Asn1BerDecodeBuffer.HandleException().