Skip to content

Confusing error handling #32

@thescribe11

Description

@thescribe11

The Problem

When uploading an entity using DataService.PostAsync(), it appears that the intent is for any errors (e.g. validation exceptions) to be put in the resulting IntuitResponse's Fault field. However, the SDK instead throws a QuickBooksSharp.QuickBooksException.

Solution

I suggest either:

  • Removing the Fault field altogether in favor of exceptions.
  • Sending exceptions to the Fault field and sealing access to the Response field behind a getter function that throws the error if present (a la Rust's Result<T, E>.unwrap()), accompanied by an IsError field/property.

I am personally in favor of the latter solution, as it would encourage users to explicitly handle errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions