Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Improve channel configuration and error handling #9

Merged
merged 7 commits into from
Jun 4, 2018

Conversation

crbelaus
Copy link
Contributor

@crbelaus crbelaus commented May 30, 2018

This pull request closes #7 and closes #8.

The main objective of this PR is to improve the Frankt channel configuration and the error handling.

Improving Frankt channel configuration

The Frankt channel configuration has been moved out of the application environment and now lives into the Frankt channel itself.

Frankt automatically sets up a behaviour on channels that ensures that some callbacks (such as the configuration for the handlers, which are always required) are provided.

At the same time, Frankt also provides a default implementation for optional configurations such as Gettext. This allows Frankt users to configure only what they need and to override default settings when needed.

Take a look at #7 for more information about the reasons for this improvement.

Improve error handling on Frankt channels

Frankt also adds a new configuration for custom error handlers. Frankt handles channel errors gracefully instead of breaking the channel process with uncontrolled exceptions.

As with optional configurations, Frankt automatically provides a default error handler that can be overriden when desired. The default error handler simply logs the exception and pushes an informative message to the channel.

Apart from handling errors in channels. Frankt also provides a Frankt.ConfigurationError module, which serves to identify which errors come from wrong Frankt configurations and which ones come from faulty logic in custom action handlers.

Take a look at #8 for more information about the reasons for this improvement.

Tasks

This is the detailed list of changes done in this PR.

  • Move configuration out of application environment and into the Frankt channel.
    • Provide a callback specification and default implementations for optional configurations.
    • Allow users to override default configurations when needed.
  • Handle errors gracefully.
    • Provide a default error handler
    • Allow users to override the default error handler if needed.
    • Wrap Frankt configuration errors in a custom error type.
    • Add tests for Frankt configuration errors.
    • Add test for error in a custom Frankt handler implementation.
    • Add test for custom error handlers in a Frankt channel.

Documentation is now obsolete, but it will be updated when addressing issue #1 .

The Frankt Channel configuration lives now on the module itself instead
of in the application environment. This allows us to typespec the
callbacks and to provide default implementations for optional ones.
@crbelaus crbelaus self-assigned this May 30, 2018
@crbelaus crbelaus changed the title Improve channel configuration and error handling WIP: Improve channel configuration and error handling May 30, 2018
Frankt channel errors are now handled gracefully instead of breaking in
an uncontrolled manner. There are two main objectives for this change:
- Don't raise uncontrolled errors that break the channel process and
handle them gracefully instead.
- Provide a sensible default error handler that can be overriden by
Frankt users if desired.
- Allow testing of errors and unexpected conditions.
@crbelaus crbelaus force-pushed the features/7-improve-channel-configuration branch from 4cd568a to ace4263 Compare May 30, 2018 18:39
crbelaus added 4 commits May 31, 2018 17:22
Frankt now provides a default error handler for channels that can be
overriden when desired. The default error handler simply logs the
received error and pushes a message to the channel.

There is also a custom ConfigurationException module that will allow
users to identify which errors come from Frankt configuration and
which ones come from custom handlers.
Uncontrolled errors in action handlers should not break the channel.
Instead, they should push an informative message into the channel.
The previous error handler was not being used by mistake.
@crbelaus crbelaus changed the title WIP: Improve channel configuration and error handling Improve channel configuration and error handling May 31, 2018
@crbelaus crbelaus merged commit f3271a5 into master Jun 4, 2018
@crbelaus crbelaus deleted the features/7-improve-channel-configuration branch June 4, 2018 17:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't raise Runtime errors from Frankt channels Improve Frankt channels configuration
1 participant