Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Add them if you've got them.
- our class X::NativeCall::DeadObject is Exception {
- has $.status = "no longer valid for use";
- has $.type = "UNSPECIFIED";
- has $.lib = "any library";
- method message {
- "This object of type $.type is $.status with $.lib."
- }
- }
- our class X::NativeCall::CannotClone is Exception {
- has $.type = "UNSPECIFIED";
- method message {
- "Native object of type $.type cannot be cloned."
- }
- }
- our class X::NativeCall::OverflowProhibited is Exception {
- has $.dtype;
- has $.value;
- method message {
- my $dtype = " of " ~ $!dtype if $!dtype.chars;
- my $value = " by value" ~ $!value if $!value.chars;
- "Prohibited overflow$dtype$value because that is dangerous here.";
- }
- }
- our class X::NativeCall::NativeError is Exception {
- has $.errno = "";
- has $.error = "";
- has $.func = "";
- has $.lib = "";
- method message {
- my $m = "Unexpected error from native API call";
- $m ~= " ($.errno)" if $.errno.chars;
- $m ~= ": $.error" if $.error.chars;
- if $.func.chars or $.lib.chars {
- $m ~= " (in ";
- $m ~= " function $.func" if $.func.chars;
- $m ~= " library $.lib" if $.lib.chars;
- $m ~= ")";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement