1package Moose::Exception::MetaclassIsARoleNotASubclassOfGivenMetaclass;
2our $VERSION = '2.2201';
3
4use Moose;
5extends 'Moose::Exception';
6with 'Moose::Exception::Role::Role';
7
8use Moose::Util 'find_meta';
9
10has 'metaclass' => (
11    is       => 'ro',
12    isa      => 'Str',
13    required => 1
14);
15
16sub _build_message {
17    my $self = shift;
18    my $role_name = $self->role_name;
19    my $role      = find_meta( $role_name );
20    my $metaclass = $self->metaclass;
21    return "$role_name already has a metaclass, but it does not inherit $metaclass ($role). "
22        ."You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.";
23}
24
25__PACKAGE__->meta->make_immutable;
261;
27