ngocnicholas / airtable.net

Airtable .NET API Client
MIT License
138 stars 34 forks source link

detailed error message not accessible? #26

Closed NickCassab closed 4 years ago

NickCassab commented 4 years ago

Hi ngocnicholas!

First off, awesome work! I love using your repo as a resource. I've even created a "wrapper" for it in this graphical node based code editor for a popular 3d modeling application called grasshopper 3d (https://www.rhino3d.com/6/new/grasshopper) my repo for the wrapper (based on your code) is located here: https://github.com/cassab/AirtableGH

I was wondering, I noticed there's a detailed error message property, and right now I can read it from within the code, but I can't expose it to the components that I've written so users can have a more detailed explanation as to why a certain request may not have worked. can this be changed?

p.s. should I make a fork of this repo? how does all that stuff work? aka (how do I credit you properly) I'm a total GitHub noob

thanks again for your work, cheers!

ngocnicholas commented 4 years ago

Hi Cassab, DetailedErrorMessage can be retrieved from the exception object via the public get accessor. See code below. --Ngoc Nicholas

public class AirtableInvalidRequestException : AirtableApiException
{
    public string DetailedErrorMessage { get; } 

    public AirtableInvalidRequestException(string errorMessage = null) : base(
        (HttpStatusCode)422, 
        "Invalid Request",
        "The request data is invalid. This includes most of the base-specific validations. The DetailedErrorMessage property contains the detailed error message string.")
    {
        DetailedErrorMessage = errorMessage;
    }
}