Class InsufficientSharesException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
me.thiagorigonatti.capitalgains.exception.InsufficientSharesException
All Implemented Interfaces:
Serializable

public class InsufficientSharesException extends RuntimeException
Exception thrown when a sell operation attempts to sell more shares than are currently held.

This is a domain-specific RuntimeException used to indicate a logical inconsistency in stock operations, where the requested quantity exceeds the available shares.

See Also:
  • Constructor Details

    • InsufficientSharesException

      public InsufficientSharesException(long requested, long available)
      Constructs an InsufficientSharesException with details about the invalid request.
      Parameters:
      requested - the number of shares requested to be sold
      available - the number of shares actually available in the portfolio