rfc:spl-improvements:exceptions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:spl-improvements:exceptions [2012/02/24 21:00] – [Provide Examples from the SPL] levim | rfc:spl-improvements:exceptions [2013/10/17 17:59] – levim | ||
---|---|---|---|
Line 4: | Line 4: | ||
* Author: Levi Morrison < | * Author: Levi Morrison < | ||
* Status: Work-in-progress | * Status: Work-in-progress | ||
- | * Special thanks: NikiC, | + | * Special thanks: NikiC, |
===== Introduction ===== | ===== Introduction ===== | ||
Line 12: | Line 12: | ||
===== Problems ===== | ===== Problems ===== | ||
- | ==== General Documentation Issues | + | ==== UnderflowException and OverflowException |
- | * There are no examples that show when to throw the specific exception. [[http:// | + | By name, people often think of underflow and overflow as mathematical overflows; you did some addition and overflowed |
- | * Descriptions | + | |
- | ==== Logic and Runtime Exceptions ==== | + | |
- | === What is a LogicException? | + | UnderflowException |
- | A LogicException | + | OverflowException |
- | " | + | |
- | **Known subclasses:** | + | I propose that we create three new exceptions: |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
+ | * StateException extends RuntimeException | ||
+ | * EmptyException extends StateException | ||
+ | * FullException extends StateException | ||
+ | This provides a general state exception for users to use (this has been requested). It additionally provides the semantic meaning of the current OverflowException and UnderflowException. We would then have OverflowException be an alias of FullException and UnderflowException be an alias of EmptyException. We may consider deprecating Overflow and Underflow exceptions. These measures are fully BC (unless there are bugs with aliases and exceptions, but simple tests I conducted showed expected behavior). | ||
- | === What is a RuntimeEexception? | + | ===== Patches ===== |
- | A RuntimeException is currently documented as: | + | A WIP for the state exceptions: |
- | " | + | |
- | + | ||
- | **Known subclasses: | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | ==== OutOfRange and OutOfBounds ==== | + | |
- | + | ||
- | ==== Domain and Range ==== | + | |
- | + | ||
- | ==== InvalidArgument ==== | + | |
- | + | ||
- | ===== Proposed Solutions ===== | + | |
- | + | ||
- | ==== Provide Inheritance Hierarchies ==== | + | |
- | + | ||
- | In the [[http:// | + | |
- | + | ||
- | Exception | + | |
- | LogicException | + | |
- | BadFunctionCallException | + | |
- | BadMethodCallException | + | |
- | DomainException | + | |
- | InvalidArgumentException | + | |
- | LengthException | + | |
- | OutOfRangeException | + | |
- | RuntimeException | + | |
- | OutOfBoundsException | + | |
- | OverflowException | + | |
- | RangeException | + | |
- | UnderflowException | + | |
- | UnexpectedValueException | + | |
- | + | ||
- | Fortunately, | + | |
- | ==== Provide Examples from the SPL ==== | + | |
- | + | ||
- | Every exception needs an example of how to use it, giving preference to examples taken from the SPL data-structures. | + |
rfc/spl-improvements/exceptions.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1