### ----------------------------------------------------
### -- OO::Plugin
### -- Licenses: Artistic-2.0
### -- Authors: Vadim Belman <vrurg@cpan.org>
### -- File: lib/OO/Plugin/Exception.rakumod
### ----------------------------------------------------
use v6.d;
use OO::Plugin::Class;

role X::Plugin {
    has Plugin:D $.plugin is required;
}

class CX::Plugin::Last does X::Control does X::Plugin {
    has $.rc;
    has Bool $.rc-set = False;

    multi submethod TWEAK ( :$!rc! ) {
        $!rc-set = True;
    }
    multi submethod TWEAK () { }

    method message { "<last plug control exception>" }
}

class CX::Plugin::Redo does X::Control does X::Plugin {
    method message { "<redo plugin chain control exception>" }
}

class X::OO::Plugin::NotFound is Exception is export {
    has Str:D $.plugin is required;

    method message {
        "No plugin '$!plugin' found"
    }
}

class X::OO::Plugin::Thrown is Exception does X::Plugin {
    has Exception:D $.exception is required;
    method message {
        "Plugin '" ~ $.plugin.name ~ "' has thrown " ~ $.exception.^name ~ ": " ~ $.exception.message
    }
}


