Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Feature: Analyse response from WHMCS API and throw ErrorException on error result. #166

@PeteBishwhip

Description

@PeteBishwhip

Is your feature request related to a problem? Please describe.
At current, a user would need to perform their own validation after running the execute method to confirm if the API command was successful.

Describe the solution you'd like
Have the WHMCSAPI wrapper check for an error in the API JSON response and throw a WHMCSAPI\Exception\ErrorException if the command did not succeed. The exception message would be that returned by the API.

Although on by default, this should be able to be disabled, and the full error JSON response provided instead of throwing an exception.

Describe alternatives you've considered
There are no other alternatives, without having to document how to capture an error in detail. By implementing this feature, simply wrapping execute in a try/catch (as already advised) would also capture any error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions