class DiscordMiddleware::Error

Overview

This middleware immediately calls the next middleware in the chain, and if any subsequent middleware raises an exception, it will be caught by this middleware allowing the user to trigger additional handling. Such as, for example, responding to the user with an error message or doing extra logging at the time of exception.

It can be initialized with a string that will be used as a canned response. The text "%exception%" will be replaced with the exception's message if provided. Alternatively, it can be initialized with a block for any other custom behavior.

Defined in:

discordcr-middleware/middleware/error.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(message : String) #

[View source]
def self.new(&block : Discord::Message, Discord::Context -> ) #

[View source]

Instance Method Detail

def call(payload : Discord::Message, context : Discord::Context, &block) #

[View source]