microsoft / botframework-components

The repository for components built by Microsoft for the Azure Bot Framework.
https://aka.ms/botdocs
MIT License
113 stars 82 forks source link

Conversational core template should implement default error handling in root dialog #689

Closed gabog closed 3 years ago

gabog commented 3 years ago

I think it would be useful to provide a default error handling implementation in the conversational core template (and all templates derived from it)

I am not sure what the recommended practices are to implement error handling and logging in composer, but we should follow them if they exist.

The error handling should:

  1. Display a friendly messagge giving a reason for the failure.
  2. Send a trace event with detailed error info (Trace Activities only show in emulator).
  3. Log the error using whatever logging mechanism is available in the underlying framework (if this is not done by the runtime).
  4. Optionally, we could look into returning detailed error information if the bot is running in emulator (or have a global debug property set but we may need to think a bit more about this)

Runtime considerations:

We should check the adapter code in the runtime but it is important to note that we need additional logic to handle error that may happen in skills. If a bot is a skill consumer we should take a look at the error handling logic in AdapterWithErrorHandle. If the bot is running as a skill, then we should make sure we support the logic that is implemented in SkillAdapterWithErrorHandler

ryanisgrig commented 3 years ago

Logging logic is in the runtime is handled at OnTurnError in CoreBotAdapter, we need to test if: when including an OnError handler, the bot executes the dialog (with friendly message/trace) THEN the OnTurnError in the runtime. If it does, then we don't need to include logging in the dialog. If it ONLY executes the dialog, then we need to add that step as well. I've tested this before but can't recall what the results were.