rmiller/error-extension

Fatal error handling extension for Behat

Maintainers

👁 mr_r_miller

Package info

github.com/richardmiller/ErrorExtension

Issues

Type:behat-extension

pkg:composer/rmiller/error-extension

Statistics

Installs: 21 370

Dependents: 3

Suggesters: 0

Stars: 7

0.5.0 2017-01-24 15:37 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 3cab7dacc98dede7eb4097520a270aeca244a41a

  • Richard Miller <mrrmiller46.woop@gmail.com>

BDDBehat

This package is not auto-updated.

Last update: 2026-06-16 11:22:41 UTC


README

👁 Scrutinizer Code Quality
👁 Build Status

Behat extension to provide formatted error messages for fatal errors.

This stops the large stack traces appearing on every fatal error. Instead a simpler formatted error showing the error message, file and line number is shown. If you need the full stack trace then they will still appear when Behat is run with the verbose flag.

Since this does work in the shutdown function there is a good chance things will go horribly wrong if there are any errors/exceptions in handing the errors. It's an extension to a dev tool though so this is not that worth worrying about.

Installation

This extension requires:

  • Behat 3.0+
  • PHP 5.4+

The easiest way to install it is to use Composer

$ composer require --dev rmiller/error-extension:^0.5

Activate the extension by specifying its class in your behat.yml:

# behat.yml
default:
 # ...
 extensions:
 RMiller\BehatSpec\Extension\ErrorExtension\ErrorExtension: ~

Error Observers

Observers can be registered for the errors to handle them in some way from another Behat extension. These must implement the following interface:

namespace RMiller\BehatSpec\Extension\ErrorExtension\Observer;

interface ErrorObserver
{
 public function notify(array $error);
}

and be tagged with rmiller.error_listener in the service configuration.

Currently this is used by the PhpSpecExtension to trigger running PhpSpec commands on relevant errors.