/** * Base class for validation errors in the buff library. * Allows consumers to catch all validation errors with a single type. */ export class ValidationError extends Error { constructor (message : string) { super(message) this.name = 'ValidationError' } } /** * Error thrown when a hex string contains invalid characters or has invalid length. */ export class HexValidationError extends ValidationError { constructor (message : string) { super(message) this.name = 'HexValidationError' } } /** * Error thrown when a byte value is outside the valid range (0-255). */ export class ByteRangeError extends ValidationError { constructor (message : string) { super(message) this.name = 'ByteRangeError' } } /** * Error thrown when an integer exceeds safe bounds. */ export class IntegerBoundsError extends ValidationError { constructor (message : string) { super(message) this.name = 'IntegerBoundsError' } } /** * Error thrown when data size doesn't match expected size. */ export class SizeError extends ValidationError { constructor (message : string) { super(message) this.name = 'SizeError' } }