From 0d3c78cf4b963d9f324c757813b37cff03fa48a1 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Sat, 27 Jul 2013 10:09:30 +0200 Subject: [PATCH] Add X::Comp::Trait exception --- src/core/Exception.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/Exception.pm b/src/core/Exception.pm index 450e053aaba..5b8e4b45f56 100644 --- a/src/core/Exception.pm +++ b/src/core/Exception.pm @@ -451,6 +451,16 @@ my class X::NYI is Exception { } my class X::Comp::NYI is X::NYI does X::Comp { }; +my class X::Trait is Exception { + has $.type; # is, will, of etc. + has $.subtype; # wrong subtype being tried + has $.declaring; # variable, sub, parameter, etc. + method message () { + "You cannot say '$.type $.subtype' in a $.declaring declaration." + } +} +my class X::Comp::Trait is X::Trait does X::Comp { }; + my class X::OutOfRange is Exception { has $.what = 'Argument'; has $.got = '';