rfc:spl-improvements:exceptions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext 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 16:09] – [UnderflowException and OverflowException] 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 | |
- | === What is a RuntimeEexception? | + | |
- | + | ||
- | A RuntimeException is currently documented as: | + | |
- | " | + | |
- | + | ||
- | **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 | + | |
- | | + | |
- | RangeException | + | |
- | | + | |
- | UnexpectedValueException | + | |
- | + | ||
- | Fortunately, | + | |
- | ==== Provide Examples from the SPL ==== | + | |
- | + | ||
- | Every exception needs an example | + |
rfc/spl-improvements/exceptions.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1