03.Restful JSON response codes - gruz/fusionpbx-api GitHub Wiki
Exceptions in PHP
To throw an exception use throw new ExtensionExistsException();
For custom exception message, use throw new ExtensionExistsException('My message');
To pass data to a default message wich users placeholders (e.g. Extension :extension for domain :domain_name already exists), you must pass it as an associative array:
throw new ExtensionExistsException([
'extension' => 'My extension code',
'domain_name' => 'mydomaine.com'
]);The table is automatically generated based on config/errors.php
| Code | Exception | Default message | Notes |
|---|---|---|---|
| 0 | Illuminate\Auth\AuthenticationException etc. | Unauthenticated Validation Error |
Core Exception. This exception is thrown by Laravel and is not over my control. I've seen it with such errors. . Maybe deal with it later. |
| 1000 | App\Auth\Exceptions\InvalidCredentialsException | Invalid credentials | |
| 1001 | Api\Extension\Exceptions\ExtensionNotFoundException | Extension not found | |
| 1002 | Api\Extension\Exceptions\InvalidExtensionException | The Extension with ID :extensionId is not an Extension | |
| 1003 | Api\User\Exceptions\UserNotFoundException | User not found | |
| 1004 | Api\Extension\Exceptions\ExtensionExistsException | Extension :extension for domain :domain_name already exists | |
| 1005 | Api\User\Exceptions\DomainExistsException | Domain already exists | |
| 1006 | Api\User\Exceptions\GroupNotFoundException | Group not found | |
| 1007 | Api\User\Exceptions\InvalidGroupException | The group with ID :groupId is not a group | |
| 1008 | Api\User\Exceptions\WrongSignupDataException | WrongSignupDataException | |
| 1009 | Api\User\Exceptions\DomainNotFoundException | Domain not found | |
| 1010 | Api\User\Exceptions\UserExistsException | User already exists | |
| 1011 | Api\User\Exceptions\EmailExistsException | Email already exists | |
| 1012 | Api\Extension\Exceptions\InvalidExtension_userException | The extension with ID :extension_userId is not an extension | |
| 1013 | Api\User\Exceptions\UserDisabledException | User disabled | |
| 1014 | Api\User\Exceptions\ActivationHashNotFoundException | User activation failed. Maybe the user has already been activated | |
| 1015 | Api\User\Exceptions\ActivationHashWrongException | Wrong activation hash | |
| 1016 | Api\Pushtoken\Exceptions\WrongPushtokenDataException | Wrong Pushtoken input data | |
| 1017 | Api\Pushtoken\Exceptions\InvalidPushtokenTypeException | Invalid push token type. Must be production or sandbox | |
| 1018 | Api\Pushtoken\Exceptions\InvalidPushtokenClassException | Invalid push token class. Must be voip or text | |
| 1019 | Api\User\Exceptions\WrongDestinationException | Bad destination to call :desitnation | |
| 1020 | Api\Dialplan\Exceptions\CouldNotInjectDialplanException | Could not symlink laravel-api dialplan to FusionPBX folder structure | |
| 1021 | Api\Status\Exceptions\InvalidStatusOSException | Invalid OS type passed: :os | |
| 1022 | Api\Status\Exceptions\InvalidStatusException | Invalid status type passed: :status . Available statuses: :available_statuses
|
|
| 1023 | Api\Status\Exceptions\InvalidServiceListException | Invalid services list | |
| 1024 | App\Exceptions\Socket\InvalidJSONInput | Invalid JSON data | |
| 1025 | App\Exceptions\Socket\NoCommadException | Missing command | |
| 1026 | App\Exceptions\Socket\TooManyConnectionAttempts | Too many connection attempts | |
| 1027 | App\Exceptions\Socket\TooManyConnections | Too many connections | |
| 1028 | App\Exceptions\Socket\TooManyMessages | Too many messages | |
| 1029 | App\Exceptions\Socket\NeedToLoginFirst | Please, login first |