2

I'm using Facebook ads api for .net and when I catch an error, the message is always the same general error:

(FacebookApiException - #100) Invalid parameter

It happens since I moved to the versioned calls (v2.2) - before that I used the unversioned calls and it was fine.

For example, this is how I get the error (using regular try catch in c#)

try
{
    var result = facebookClient.Post("v2.2/act_" + accountId + "/adgroups", parameters) as IDictionary<string, object>;
}
catch (Exception ex)
{
    throw ex; // The error should be in ex.Message
}

Is there a way to extract the real error message from the exception?

Tal Yaari
  • 463
  • 6
  • 15
  • can you link to the library you're using? – Paul Bain Apr 01 '15 at 15:27
  • We use Facebook.dll version 6.4.2.0. I think we downloaded it from here: http://www.nuget.org/packages/Facebook/ – Tal Yaari Apr 01 '15 at 16:23
  • Do you need more details? @PaulBain – Tal Yaari Apr 08 '15 at 07:37
  • 1
    What values are you posting in parameters? – Hey Darren Apr 08 '15 at 08:26
  • The required parameters for creating an adgroup (such as name, campaign_id, creative etc.). My question is not why I get the error - my question is how can I extract the real error message from the exception, instead of getting the general "invalid parameter" message. – Tal Yaari Apr 08 '15 at 11:04
  • Did you try to test your raw http request with graph API explorer so that you can see if with any combination you get more detailed error messages? The error messages are same across various platforms. Hence you could use tools like https://developers.facebook.com/tools/explorer/ to make sure you get your parameters right. – Nithya Sivakumar Apr 17 '15 at 07:08

1 Answers1

0

Thanks everyone for your help. I dived into this issue and it's not a Facebook problem. The problem is in the third party SDK.

I contacted the development team, they aware of this issue and started fixing it.

Tal Yaari
  • 463
  • 6
  • 15
  • which API are you using? – Simon_Weaver Nov 17 '15 at 22:48
  • I am having this same issue. Instead of capturing for example the actual Facebook error #32, you get a generic message "The remote server returned an error: (400) Bad Request.". Inner exception also remains null. – ibexy Jan 27 '18 at 06:00