-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from PerfectThymeTech/marvinbuss/restructure_app
Restructure core app
- Loading branch information
Showing
6 changed files
with
71 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Function App Deployment | ||
name: Web App Deployment | ||
on: | ||
push: | ||
branches: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from datetime import datetime | ||
|
||
from botbuilder.core import TurnContext | ||
from botbuilder.schema import Activity, ActivityTypes | ||
from utils import get_logger | ||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
class BotUtils: | ||
|
||
@staticmethod | ||
async def on_error(turn_context: TurnContext, error: Exception) -> None: | ||
"""Handles errors in the bot. | ||
turn_context (TurnContext): The turn context. | ||
error (Exception): The exception in the bot framework. | ||
RETURNS (None): No return value. | ||
""" | ||
# Log error | ||
logger.error("Unexpected error within the application", error) | ||
|
||
# Send a message to the user | ||
await turn_context.send_activity( | ||
"The bot encountered an error or bug. The team will get notified and look into the issue. Sorry for any inconveniences caused." | ||
) | ||
|
||
# For the Bot Framework emulator channel send a trace activity | ||
if turn_context.activity.channel_id == "emulator": | ||
# Create a trace activity that contains the error object | ||
trace_activity = Activity( | ||
label="TurnError", | ||
name="on_turn_error Trace", | ||
timestamp=datetime.now(datetime.UTC), | ||
type=ActivityTypes.trace, | ||
value=f"{error}", | ||
value_type="https://www.botframework.com/schemas/error", | ||
) | ||
# Send a trace activity, which will be displayed in Bot Framework Emulator | ||
await turn_context.send_activity(trace_activity) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters