PHP code example of tjventurini / graphql-exceptions

1. Go to this page and download the library: Download tjventurini/graphql-exceptions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tjventurini / graphql-exceptions example snippets


use Tjventurini\GraphQLExceptions\Facades\GraphqlExceptions;

GraphQLExceptions::wrap(function() {
    // your logic
});

    /*
     |--------------------------------------------------------------------------
     | Exception Map
     |--------------------------------------------------------------------------
     |
     | In the following array you can add exceptions to be resolved.
     |
    */

    'exception_map' => [
        Illuminate\Validation\ValidationException::class            => Tjventurini\GraphQLExceptions\Exceptions\ClientSaveValidationGraphQLException::class,
        Illuminate\Database\Eloquent\ModelNotFoundException::class  => Tjventurini\GraphQLExceptions\Exceptions\ClientSaveModelNotFoundGraphQLException::class,
        Illuminate\Auth\AuthenticationException::class              => Tjventurini\GraphQLExceptions\Exceptions\ClientSaveAuthenticationGraphQLException::class,
    ],

    /*
     |--------------------------------------------------------------------------
     | Default Exception
     |--------------------------------------------------------------------------
     |
     | The following exception will be thrown when no matching exception was
     | found in the exception map.
     |
    */

    'default_exception' => Tjventurini\GraphQLExceptions\Exceptions\ClientSaveInternalGraphQLException::class,