I'm currently trying to set up a chat bot using botframework and LUIS.
LUIS has a free account in which 10.000 calls per month are included. When exceeding this limit ones application recieves a "403 Quota Exceeded" error.
At the moment the bot is answering with the error and I would like it to ignore and don't reply when an error is thrown.
I'm pretty much using the BotBuilder Sample Code: https://github.com/Microsoft/BotBuilder/tree/master/CSharp/Samples/SimpleEchoBot
Adding a generic try/catch in the MessageController
Post
action doesn't resolve the issue.
[ResponseType(typeof(void))]
public virtual async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
// check if activity is of type message
if (activity != null && activity.GetActivityType() == ActivityTypes.Message)
{
try
{
await Conversation.SendAsync(activity, MakeRoot);
}
catch (Exception ex)
{
System.Diagnostics.Trace.TraceError(ex.Message);
}
}
else
{
HandleSystemMessage(activity);
}
return new HttpResponseMessage(System.Net.HttpStatusCode.Accepted);
}
internal static IDialog<object> MakeRoot()
{
return Chain.From(() => new DefaultDialog());
}
DefaultDialog
is inheriting the LuisDialog<T>
class.
[LuisModel("---", "---", domain: "westeurope.api.cognitive.microsoft.com")]
[Serializable]
public class DefaultDialog : LuisDialog<object>
{
[LuisIntent("")]
public async Task None(IDialogContext context, LuisResult result)
{
context.Wait(MessageReceived);
}
...
}
The error is thrown, I'm able to catch it but the bot still answers.