2017 © Pedro Peláez
 

library exceptionist

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

image

nimayneb/exceptionist

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  • Monday, September 18, 2017
  • by nimayneb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Exceptionist

Throwing meaningful and semantic exceptions with interfaces, (*1)

Exception class names contain no word "Exception" in it. This is a redundant information and it is easier to understand and to read., (*2)

Usage:, (*3)

use JBR\Exceptionist\InvalidArgument;
use JBR\Exceptionist\InvalidityReason:

function throwsAnException() {
    throw new InvalidArgument('An Argument is invalid');
}

try {
    throwsAnException();
} catch (InvalidityReason $e) {
    echo $e->getMessage();
}

use JBR\Exceptionist\EmptyArgument;
use JBR\Exceptionist\InvalidityReason:
use JBR\Exceptionist\DeficiencyReason;

function throwsAlsoAnException() {
    throw new EmptyArgument('An Argument is empty');
}

try {
    throwsAlsoAnException();
} catch (InvalidityReason|DeficiencyReason $e) {
    echo $e->getMessage();
}

Kind of exceptions: - Empty - something is set, but have empty content - Invalid - something is set, but has invalid characters or is in an invalid format - Unknown - something is set, but it is unknown (not invalid) - Missing - something is set, but its needs is missing - Timeout - something is set, but it cannot be read in a particular time window, (*4)

Kind of reasons: - Absence - something is not reachable in a particular time window - Compatibility - something is broken by compatibility - Deficiency - something is needed, but is absent - Invalidity - something is needed, but is invalid, (*5)

Kind of scopes: - Access - something with accessibilities - Action - something with actions - Argument - something with arguments of a method - something with arguments of an object - Class - something with class instancing - Configuration - something with configuration - Declaration - something with declarations - Definition - something with definitions - Dependency - something with dependencies - Interface - something with interfaces - Method - something with methods of an object - Object - something with objects - Property - something with properties of an object - Reference - something with references - Requirement - something with requirements - Return - something with returns of an object - something with returns of an method - Trait - something with traits - Type - something with types of a return - something with types of a method - something with types of an object - Value - something with value, (*6)

Compose exceptions for your application:

Create an interface or a trait for your application - so you are able to catch only the exceptions of your application., (*7)

interface YourApplication {
}

Create your exception:, (*8)

use JBR\Exceptionist\InvalidParser;

class InvalidParserType extends InvalidParser implements YourApplication {

}

The Versions

18/09 2017

1.2.0

1.2.0.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0

 

17/09 2017

1.1.3

1.1.3.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0

 

17/09 2017

1.1.2

1.1.2.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0

 

16/09 2017

1.1.1

1.1.1.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0

 

01/09 2017

1.1.0

1.1.0.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0

 

01/09 2017

1.0.1

1.0.1.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0

 

01/09 2017

1.0.0

1.0.0.0

Exceptionist - Throwing meaningful and semantic exceptions with interfaces

  Sources   Download

The Requires

  • php >=7.0