diff --git a/example/build.sh b/example/build.sh index cc9f672..2a1c9a8 100755 --- a/example/build.sh +++ b/example/build.sh @@ -32,5 +32,5 @@ dmcs taxonomy.cs -r:System.Data.dll -r:System.Web.dll -r:../module/AlchemyAPI.dl dmcs image.cs -r:System.Data.dll -r:System.Web.dll -r:../module/AlchemyAPI.dll -dmcs ranked_image_keywords.cs -r:System.Data.dll -r:System.Web.dll -r:../module/AlchemyAPI.dll +dmcs ranked_image_keywords.cs -r:System.Data.dll -r:System.Web.dll -r:../module/AlchemyAPI.dll -r:System.Drawing.dll diff --git a/module/AlchemyAPI.cs b/module/AlchemyAPI.cs index 60144dc..4b7a25d 100644 --- a/module/AlchemyAPI.cs +++ b/module/AlchemyAPI.cs @@ -955,8 +955,18 @@ private string DoRequest(HttpWebRequest wreq, AlchemyAPI_BaseParams.OutputMode o if (status.InnerText != "OK") { - System.ApplicationException ex = - new System.ApplicationException ("Error making API call."); + string errorMessage = "Error making API call."; + + try + { + XmlNode statusInfo = root.SelectSingleNode("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/results/statusInfo"); + errorMessage = statusInfo.InnerText; + } + catch + { + errorMessage = "An error occurred: Unable to access XmlNode /results/statusInfo"; + } + System.ApplicationException ex = new System.ApplicationException (errorMessage); throw ex; } @@ -970,8 +980,18 @@ private string DoRequest(HttpWebRequest wreq, AlchemyAPI_BaseParams.OutputMode o if (status.InnerText != "OK") { - System.ApplicationException ex = - new System.ApplicationException ("Error making API call."); + string errorMessage = "Error making API call."; + + try + { + XmlNode statusInfo = root.SelectSingleNode("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/results/statusInfo"); + errorMessage = statusInfo.InnerText; + } + catch + { + errorMessage = "An error occurred: Unable to access XmlNode /results/statusInfo"; + } + System.ApplicationException ex = new System.ApplicationException (errorMessage); throw ex; }