All Projects → yiisoft → Friendly Exception

yiisoft / Friendly Exception

Licence: bsd-3-clause
An interface for an exception to be friendly

Projects that are alternatives of or similar to Friendly Exception

custom-exception-middleware
Middleware to catch custom or accidental exceptions
Stars: ✭ 30 (-26.83%)
Mutual labels:  error-handling, exceptions
Data Structures
Go datastructures.
Stars: ✭ 336 (+719.51%)
Mutual labels:  error-handling, exceptions
Fluentresults
A generalised Result object implementation for .NET/C#
Stars: ✭ 266 (+548.78%)
Mutual labels:  hacktoberfest, error-handling
Bugsnag Ruby
Bugsnag error monitoring & reporting software for rails, sinatra, rack and ruby
Stars: ✭ 211 (+414.63%)
Mutual labels:  error-handling, exceptions
Bugsnag Php
Bugsnag error monitoring and crash reporting tool for PHP apps
Stars: ✭ 475 (+1058.54%)
Mutual labels:  error-handling, exceptions
Exceptionless
Exceptionless server and jobs
Stars: ✭ 2,107 (+5039.02%)
Mutual labels:  hacktoberfest, error-handling
Tslog
📝 tslog - Expressive TypeScript Logger for Node.js.
Stars: ✭ 321 (+682.93%)
Mutual labels:  error-handling, exceptions
Bugsnag Go
Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
Stars: ✭ 155 (+278.05%)
Mutual labels:  error-handling, exceptions
Collision
💥 Collision is a beautiful error reporting tool for command-line applications
Stars: ✭ 3,993 (+9639.02%)
Mutual labels:  hacktoberfest, exceptions
Bugsnag React Native
Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
Stars: ✭ 374 (+812.2%)
Mutual labels:  error-handling, exceptions
Exceptions4c
🐑 An exception handling framework for C
Stars: ✭ 189 (+360.98%)
Mutual labels:  error-handling, exceptions
Bugsnag Js
Javascript error handling tool for Bugsnag. Monitor and report JavaScript bugs & errors.
Stars: ✭ 625 (+1424.39%)
Mutual labels:  error-handling, exceptions
Pyrollbar
Error tracking and logging from Python to Rollbar
Stars: ✭ 169 (+312.2%)
Mutual labels:  error-handling, exceptions
bugsnag-java
Bugsnag error reporting for Java.
Stars: ✭ 51 (+24.39%)
Mutual labels:  error-handling, exceptions
Bugsnag Cocoa
Bugsnag crash reporting for iOS, macOS and tvOS apps
Stars: ✭ 167 (+307.32%)
Mutual labels:  error-handling, exceptions
Rollbar Php
Error tracking and logging from PHP to Rollbar
Stars: ✭ 297 (+624.39%)
Mutual labels:  error-handling, exceptions
Bugsnag Node
[DEPRECATED] Please upgrade to our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
Stars: ✭ 48 (+17.07%)
Mutual labels:  error-handling, exceptions
Ben.demystifier
High performance understanding for stack traces (Make error logs more productive)
Stars: ✭ 2,142 (+5124.39%)
Mutual labels:  error-handling, exceptions
Exceptionless.net
Exceptionless clients for the .NET platform
Stars: ✭ 362 (+782.93%)
Mutual labels:  hacktoberfest, exceptions
Traceback with variables
Adds variables to python traceback. Simple, lightweight, controllable. Debug reasons of exceptions by logging or pretty printing colorful variable contexts for each frame in a stacktrace, showing every value. Dump locals environments after errors to console, files, and loggers. Works in Jupyter and IPython. Install with pip or conda.
Stars: ✭ 509 (+1141.46%)
Mutual labels:  error-handling, exceptions

Yii Friendly Exception


Latest Stable Version Total Downloads

An exception interface that provides a friendly name and a possible solution. Error handlers may consider the interface to render additional information right at the error screen.

Requirements

  • PHP 7.1 or higher.

Installation

The package could be installed with composer:

composer require yiisoft/friendly-exception --prefer-dist

General usage

Implementing friendly exception

To make exception friendly require this package and implement FriendlyExceptionInterface:

<?php

declare(strict_types=1);

use Yiisoft\FriendlyException\FriendlyExceptionInterface;

class RequestTimeoutException extends \RuntimeException implements FriendlyExceptionInterface
{
    public function getName(): string
    {
        return 'Request timed out.';
    }
    
    public function getSolution(): ?string
    {
        return <<<'SOLUTION'
            Likely it is a result of resource request is not responding in a timely fashion. Try increasing timeout.
            SOLUTION;
    }
}

When returning solution consider the following best practices:

  1. Make solution description as short as possible.
  2. Do not use HTML tags.
  3. A simple markdown is OK but its support is up to implementation.

Handling friendly exception

To make your exception handler render friendly exceptions:

use Yiisoft\FriendlyException\FriendlyExceptionInterface;

class ThrowableHandler
{
    public function handle(\Throwable $t)
    {
        if ($t instanceof FriendlyExceptionInterface) {
            // additional handling
        }
        // regular handling
    }
}

License

The Yii Friendly Exception is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].