As noted elsewhere in this manual, the asn1c runtime and generated code will throw exceptions that are, or derive from, Asn1Exception. The exception tells you what was wrong and provides a stack trace. If you need additional information you may try the following:
Identify the byte location in the input data using Asn1DecodeBuffer.getByteCount().
Identify the problem element using element name tracking. The procedure to do this is simple:
Add "-events" to your asn1c command line. This is necessary for element name tracking to work.
Obtain an Asn1Context object from your encode/decode buffer using Asn1MessageBuffer.getContext().
Enable element name tracking before encoding/decoding by invoking Asn1Context.enableElementTracking().
Get the name of the problem element by invoking Asn1Context.getCurrentElement() inside your exception handling code.
Element name tracking is demonstrated in the sample Writer in sample_ber/EventHandler.