Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18451

exception for invalid return value

From alex <1j9448a02@lnx159sneakemail.com.invalid>
Newsgroups comp.lang.php
Subject exception for invalid return value
Date 2020-12-07 10:59 +0100
Organization Aioe.org NNTP Server
Message-ID <rqkudo$1vbd$1@gioia.aioe.org> (permalink)

Show all headers | View raw


final class BoolVsThrow {

     final public static function rewind($stream, $exception) {
         if (!rewind($stream)) {
             throw $exception;
         }

         return $stream;
     }

}

The problem is that I don't know which exception pass to the method 
BoolVsThrow::rewind().

Some examples:

BoolVsThrow::rewind($stream, new \Exception);
BoolVsThrow::rewind($stream, new \InvalidArgumentException);
BoolVsThrow::rewind($stream, new \UnexpectedValueException);

The most appropriate exception?

Back to comp.lang.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

exception for invalid return value alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-07 10:59 +0100
  Re: exception for invalid return value Jerry Stuckle <jstucklex@attglobal.net> - 2020-12-07 10:58 -0500
  Re: exception for invalid return value Jerry Stuckle <jstucklex@attglobal.net> - 2020-12-07 16:00 -0500
    Re: exception for invalid return value alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-08 10:25 +0100
      Re: exception for invalid return value alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-08 10:28 +0100

csiph-web