Re: Proposal: Introduction of InvalidStateException

From: Date: Thu, 17 Oct 2013 14:46:23 +0000
Subject: Re: Proposal: Introduction of InvalidStateException
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> > I would like to propose the introduction of an 'InvalidStateException'
>> > into the SPL extension. Within the existing exceptions I am not able
>> > to find a type that would represent a state error, throwable if a
>> > method has been invoked at an illegal or inappropriate time.
>>
>> Exceptions are one part of the SPL that are a nasty, poorly thought-out
>> mess (no offense to anyone who worked on it; this stuff is harder than
>> people realize). I am -1 on simply adding another exception to our mess,
>> but if we can clean it up then I might support it, depending on details.
>
>
> I'd love to listen your ideas/suggestions. Maybe we can implement an RFC
> to make it better.
> Without exposure to problems, there are no problems at all.
>
> I'm not saying it's perfect, but would love ideas on how we can improve
> it. =)
>

As an example of my idea of progress:
https://github.com/morrisonlevi/Ardent/blob/master/Exceptions.md

   - DomainException
   - FunctionException
   - LookupException (The two sub-classes here may be unnecessary; just one
   may do)
      - IndexException
      - KeyException
   - StateException
      - EmptyException
      - FullException
   - TypeException

Of course, this is not backwards compatible. It does, however, include a
StateException that is relevant here. I'm not implying that my exceptions
hierarchy is complete, but a good deal of thought and use has gone into
them so far.


Thread (14 messages)

« previous php.internals (#69628) next »