Skip to content

Commit

Permalink
Add missing private error handling method
Browse files Browse the repository at this point in the history
Spotted by jjatria++ .  Also restructure a bit to prevent repetition
  • Loading branch information
lizmat committed Jun 15, 2022
1 parent f2546b4 commit 32a4079
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/core.c/Buf.pm6
Expand Up @@ -856,15 +856,24 @@ my role Blob[::T = uint8] does Positional[T] does Stringy is repr('VMArray') is
:range("0..{nqp::elems(self)-1}")
).Failure
}
method !fail-typecheck-element(\action,\i,\got) {
self!fail-typecheck(action ~ "ing element #" ~ i,got);
}
method !fail-typecheck($action,$got) {
method !typecheck($action, $got) {
X::TypeCheck.new(
operation => $action ~ " to " ~ self.^name,
got => $got,
expected => T,
).Failure
)
}
method !fail-typecheck($action,$got) {
self!typecheck($action, $got).Failure
}
method !typecheck-element($action, $i, $got) {
self!typecheck($action ~ "ing element #" ~ $i, $got)
}
method !fail-typecheck-element($action, $i, $got) {
self!typecheck-element($action, $i, $got).Failure
}
method !throw-typecheck-element($action, $i, $got) {
self!typecheck-element($action, $i, $got).throw
}
multi method ACCEPTS(Blob:D: Blob:D \Other) {
nqp::hllbool(
Expand Down

0 comments on commit 32a4079

Please sign in to comment.