# Class BERNodeError

java.lang.Object
com.snmp4j.smi.ber.BERNode
com.snmp4j.smi.ber.BERNodeError

public class BERNodeError extends BERNode
A BER node representing a parse error: a deviation from the expected SNMP message structure.

Since:
  2.0.0
Author:
  Frank Fock

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BERNodeError(int position, String errorMessage, byte[] offendingBytes, List<Integer> expectedTags)`
  Creates a BER node representing a parse error.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<Integer>`
  `getErrorExpectedTags()`
  Gets the BER tag values expected at this position.
  `String`
  `getErrorMessage()`
  Gets the human-readable error message.
  `byte[]`
  `getOffendingBytes()`
  Gets the raw bytes at the error position.
  `String`
  `toString()`
  Returns a multi-line string representation of this BER node.

  ### Methods inherited from class BERNode

  `addChild, getChildren, getData, getDescription, getExpectedTags, getFormattedValue, getOid, getPos, getSequenceLength, getTag, getTagHex, getTagName, getTotalLength, isDecrypted, setDecrypted, setDescription, setExpectedTags, setFormattedValue, setOid, setSequenceLength`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### BERNodeError

    public BERNodeError(int position, String errorMessage, byte[] offendingBytes, List<Integer> expectedTags)
    Creates a BER node representing a parse error.
    Parameters:
      `position` - byte offset in the raw message where the error was detected
      `errorMessage` - human-readable description of the error
      `offendingBytes` - raw bytes at the error position (may be empty or null)
      `expectedTags` - BER tag values that were expected at this position (decimal)

- ## Method Details

  - ### getErrorMessage

    public String getErrorMessage()
    Gets the human-readable error message.
    Returns:
      the error message

  - ### getOffendingBytes

    public byte[] getOffendingBytes()
    Gets the raw bytes at the error position.
    Returns:
      the raw bytes at the error position.

  - ### getErrorExpectedTags

    public List<Integer> getErrorExpectedTags()
    Gets the BER tag values expected at this position.
    Returns:
      the BER tag values that were expected at this position (decimal)

  - ### toString

    public String toString()
    Description copied from class: `BERNode`
    Returns a multi-line string representation of this BER node.
    Overrides:
      `toString` in class `BERNode`
    Returns:
      a string representation of this BER node.