Skip to content

V10x: Strongly Typed Exceptions #1454

Description

@TonyValenti

Hi Box Team:
Currently when the API generates an exception, it might return JSON like this:

{
  "type": "error",
  "status": 409,
  "code": "item_name_in_use",
  "context_info": {
    "conflicts": [
      {
        "type": "folder",
        "id": "376299255639",
        "sequence_id": "0",
        "etag": "0",
        "name": "Rec'd deed copy from Bastrop county-"
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Item with the same name already exists",
  "request_id": "714r3iic3iyf6l48"
}

The exception is a BoxApiException and in order for me to handle that exception nicely, I essentially have to manually parse the Message property as it contains the JSON of the error.

Can you please enhance the exception aspect of the V10 SDK?

ideally, there should be an exception class for each error code.
For example, something like:

public class ItemNameInUseBoxApiException : BoxApiException {
   public ImmutableArray<ConflictJson>? Conflicts {get; init; }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions