glpi-project / php-library-glpi

GLPI API Client Library for PHP
https://glpi-project.github.io/php-library-glpi/
GNU General Public License v3.0
25 stars 21 forks source link

Error handling #20

Closed ajsb85 closed 7 years ago

ajsb85 commented 7 years ago

Hi, @DIOHz0r

I will put here all possible errors for the library.

ajsb85 commented 7 years ago

Handle error when no dependencies are installed

require_once __DIR__ . '/../vendor/autoload.php';

Reference: https://stackoverflow.com/questions/8261756/how-to-catch-error-of-require-or-include-in-php

ajsb85 commented 7 years ago

"Cannot connect to api" is a general message. The API reply with a proper message, please use it.

Reference: https://git.io/vFvSp

ajsb85 commented 7 years ago

Create a custom error messages when it's not provided by the API

DIOHz0r commented 7 years ago

Handle error when no dependencies are installed

This is not a normal practice in PHP, when a file is not included or the class is not founded PHP will throw an error by default.

btry commented 7 years ago

This is a library. Something will depend on it and the library will depend on others.

This is Composer's task to guarantee to our lib that all dependencies are available. I agree to delegate to Composer.