yonna/throwable

Yonna 异常处理

1.0 2019-09-12 15:29 UTC

This package is auto-updated.

Last update: 2024-04-15 18:40:21 UTC


README

License Repo Size Downloads Version Php

Yonna throwable库

throwable更好地管理抛出/错误
你可以简单地运送默认的组件操作你的错误

如何安装

可以通过composer安装:composer require yonna/throwable
可以通过git下载:git clone https://github.com/yonna-framework/throwable.git

Yonna demo:GOTO yonna

Example

使用 Throwable 管理你的 Exception

<?php
    

    use Yonna\Throwable\Exception;
    
    // 按原来捕捉抛出
    try{
        // ...
    } catch (\Throwable $e){
        Exception::origin($e);
    }
    
    Exception::throw('default exception');
    Exception::params('oh my params');
    Exception::database('oh my database');
    Exception::sdk('oh my sdk');
    Exception::debug('oh my debug');
    // more
    
?>

使用 Throwable 管理你的 Error

<?php
    

    use Yonna\Throwable\Error;
    
    Error::throw('default');
    Error::notice('notice');
    Error::warning('warning');
    Error::deprecated('deprecated');
    
?>