The Perl Advent Calendar needs more articles for 2022. Submit your idea today!
package Moose::Exception::CodeBlockMustBeACodeRef;
our $VERSION = '2.2201';

use Moose;
extends 'Moose::Exception';
with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Instance';

sub _build_message {
    "Your code block must be a CODE reference";
}

__PACKAGE__->meta->make_immutable;
1;