]> gitweb.factorcode.org Git - factor.git/commitdiff
Friendlier grouping/clumping error message
authorJon Harper <jon.harper87@gmail.com>
Sun, 28 Oct 2012 12:50:16 +0000 (13:50 +0100)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 28 Oct 2012 20:33:51 +0000 (13:33 -0700)
basis/debugger/debugger.factor
basis/grouping/grouping.factor

index 154c7b7a408d33d159fcb9b842e088725bfb0a7d..d3d4b14a06c48b0951844277567b4990f2377051 100755 (executable)
@@ -10,7 +10,7 @@ classes compiler.units generic.standard generic.single vocabs
 init kernel.private io.encodings accessors math.order
 destructors source-files parser classes.tuple.parser
 effects.parser lexer generic.parser strings.parser vocabs.loader
-vocabs.parser source-files.errors ;
+vocabs.parser source-files.errors grouping ;
 IN: debugger
 
 GENERIC: error-help ( error -- topic )
@@ -220,6 +220,8 @@ M: slice-error summary
 
 M: bounds-error summary drop "Sequence index out of bounds" ;
 
+M: groups-error summary drop "Non positive group size" ;
+
 M: condition error. error>> error. ;
 
 M: condition summary error>> summary ;
index 6cc5bb164a75529b536a531e6556b15e61c18ce0..83d48a14ad5e887dfbcbe2d8278a5673b86b4f22 100644 (file)
@@ -4,6 +4,7 @@ USING: kernel math math.order strings arrays vectors sequences
 sequences.private accessors fry combinators ;
 IN: grouping
 
+ERROR: groups-error seq group-size ;
 <PRIVATE
 
 MIXIN: chunking
@@ -53,8 +54,8 @@ M: abstract-clumps group@
 
 TUPLE: chunking-seq { seq read-only } { n read-only } ;
 
-: check-groups ( n -- n )
-    dup 0 <= [ "Invalid group count" throw ] when ; inline
+: check-groups ( seq n -- seq n )
+    dup 0 <= [ groups-error ] when ; inline
 
 : new-groups ( seq n class -- groups )
     [ check-groups ] dip boa ; inline