Skip to content

Commit

Permalink
# Adding hint message only if clientexception contains 'access denied…
Browse files Browse the repository at this point in the history
…' (code is zero)
  • Loading branch information
maurok committed May 19, 2017
1 parent 25b0194 commit 8af04b2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Bot.Connector;
using Microsoft.ProjectOxford.Vision;
using Services;

[BotAuthentication]
Expand Down Expand Up @@ -42,7 +43,11 @@ public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
}
catch (Exception e)
{
message = "Oops! Something went wrong. Try again later (hint: check your APIKEY at web.config).";
message = "Oops! Something went wrong. Try again later";
if (e is ClientException && (e as ClientException).Error.Message.ToLowerInvariant().Contains("access denied"))
{
message += " (access denied - hint: check your APIKEY at web.config).";
}

Trace.TraceError(e.ToString());
}
Expand Down

0 comments on commit 8af04b2

Please sign in to comment.