2017 © Pedro Peláez
 

library exceptions

Set of the base exceptions

image

thezee/exceptions

Set of the base exceptions

  • Tuesday, June 20, 2017
  • by slavcodev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Set of the base exceptions

Build Status ![Code Coverage][ico-scrutinizer] Quality Score ![GitHub issues][ico-issues], (*1)

Software License Latest Version on Packagist ![PHP Version][ico-php-version], (*2)

This repository contains a set of useful exception classes., (*3)

The exception classes interface is extended with array of context data, because often the message and the code are not enough to debug., (*4)

Install

Using Composer:, (*5)

composer require zeeproject/exceptions

Usage

Throw exceptions as usual, but you are able also to add context values:, (*6)

throw new InvalidArgumentException('Something went wrong', [
    'key' => 'value',
]);

Now you can handle this exception, e.q. your error handler may log error details:, (*7)

final class ErrorHandler
{
    private $logger;

    public function __construct(Psr\Log\LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    public function handleException(Exception $exception)
    {
        if ($exception instanceof Zee\Exceptions\Throwable) {
            $this->logger->error($exception->getMessage(), $exception->getContext());
        } else {
            $this->logger->error($exception->getMessage());
        }
    }
}

Testing

phpunit

Contributing

Please see CONTRIBUTING and CODE OF CONDUCT for more details., (*8)

The Versions

20/06 2017

dev-master

9999999-dev

Set of the base exceptions

  Sources   Download

BSD-2-Clause

The Requires

  • ext-json *
  • php ^7.0

 

The Development Requires

by Veaceslav Medvedev

logging exceptions

20/06 2017

0.1

0.1.0.0

Set of the base exceptions

  Sources   Download

BSD-2-Clause

The Requires

  • ext-json *
  • php ^7.0

 

The Development Requires

by Veaceslav Medvedev

logging exceptions