# Previous (manual OO) code: sub error_mode { my ($s, $mode) = @_; if ($mode) { $s->_err('Invalid error_mode', $s->{error_mode}) unless $mode =~ /^(carp|error|both)$/; $s->{error_mode} = $mode; } $s->{error_mode}; } #### # Converted to Mouse: enum 'ErrorMode' => qw; has 'error_mode' => ( is => 'rw', isa => 'ErrorMode', default => 'error' ); #### Attribute (error_mode) does not pass the type constraint because: Validation failed for 'ErrorMode' with value at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Mouse/Util.pm line 395. Mouse::Util::throw_error(Mouse::Meta::Attribute=HASH(0x56165c0b5528), "Attribute (error_mode) does not pass the type constraint beca"..., "data", "", "depth", -1) called at ./t/05-errors.t line 16