]> gitweb.factorcode.org Git - factor.git/commitdiff
factor: Change ERROR: foo ; to define ``throw-foo`` instead of having ``foo`` throw...
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 12 Aug 2015 20:26:18 +0000 (15:26 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 12 Aug 2015 20:26:18 +0000 (15:26 -0500)
53 files changed:
basis/bootstrap/help/help.factor
basis/help/help.factor
basis/io/encodings/8-bit/8-bit.factor
basis/io/encodings/euc/euc.factor
basis/io/encodings/gb18030/gb18030.factor
basis/io/encodings/iso2022/iso2022.factor
basis/io/encodings/shift-jis/shift-jis.factor
basis/io/encodings/strict/strict.factor
basis/macros/macros.factor
basis/tools/deploy/deploy.factor
basis/tools/scaffold/scaffold.factor
basis/vocabs/metadata/metadata.factor
core/alien/alien.factor
core/alien/strings/strings.factor
core/classes/algebra/algebra.factor
core/classes/builtin/builtin.factor
core/classes/classes.factor
core/classes/mixin/mixin.factor
core/classes/tuple/parser/parser.factor
core/classes/tuple/tuple-tests.factor
core/classes/tuple/tuple.factor
core/classes/union/union.factor
core/combinators/combinators.factor
core/continuations/continuations.factor
core/definitions/definitions.factor
core/destructors/destructors.factor
core/effects/effects.factor
core/effects/parser/parser.factor
core/generic/generic.factor
core/generic/math/math.factor
core/generic/parser/parser.factor
core/generic/single/single.factor
core/hashtables/hashtables.factor
core/io/encodings/ascii/ascii.factor
core/io/encodings/utf16/utf16.factor
core/io/pathnames/pathnames.factor
core/kernel/kernel.factor
core/lexer/lexer.factor
core/math/math.factor
core/math/parser/parser.factor
core/math/ratios/ratios.factor
core/parser/parser.factor
core/sequences/sequences.factor
core/slots/slots.factor
core/source-files/source-files.factor
core/strings/parser/parser.factor
core/syntax/syntax-docs.factor
core/syntax/syntax.factor
core/vocabs/loader/loader-docs.factor
core/vocabs/loader/loader.factor
core/vocabs/parser/parser.factor
core/vocabs/vocabs.factor
core/words/words.factor

index 85e94d5a1e6941576e98040eb1d13a26ee84a403..4d10a0beb0bfc2185dbf457fcc8319e867843b7d 100644 (file)
@@ -13,7 +13,7 @@ IN: bootstrap.help
 
     t load-help? set-global
 
-    [ dup lookup-vocab [ drop ] [ no-vocab ] if ] require-hook [
+    [ dup lookup-vocab [ drop ] [ throw-no-vocab ] if ] require-hook [
         dictionary get values
         [ docs-loaded?>> ] reject
         [ load-docs ] each
index d02ce72f7bde0d6c51d38750a81024956fa8e6ed..5c88e85a5dbd93fc15dcf4f0064690ae2c72645b 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs classes classes.tuple
-combinators combinators.short-circuit continuations debugger
-effects generic help.crossref help.markup help.stylesheet
+classes.error combinators combinators.short-circuit continuations
+debugger effects generic help.crossref help.markup help.stylesheet
 help.topics io io.styles kernel make namespaces prettyprint
 sequences sorting vocabs words words.symbol ;
 IN: help
index 8aec5cb496d372504c85b31b30942d26fb178fe1..17b3a274f95a151bf2adfba37dc7dd788f9b1d02 100644 (file)
@@ -18,7 +18,7 @@ SYMBOL: 8-bit-encodings
 TUPLE: 8-bit { biassoc biassoc read-only } ;
 
 : 8-bit-encode ( char 8-bit -- byte )
-    biassoc>> value-at [ encode-error ] unless* ; inline
+    biassoc>> value-at [ throw-encode-error ] unless* ; inline
 
 M: 8-bit encode-char
     swap [ 8-bit-encode ] dip stream-write1 ;
index 63a2c69cffcaf2c6975f29ba75e24d9eee44b32f..3938431c9c2ea2c67246b26bcdceed84097353d6 100644 (file)
@@ -19,7 +19,7 @@ M: euc encode-char ( char stream encoding -- )
             h>b/b swap 2byte-array
             swap stream-write
         ] if
-    ] [ encode-error ] if* ;
+    ] [ throw-encode-error ] if* ;
 
 : euc-multibyte? ( ch -- ? )
     0x81 0xfe between? ;
index 7e9d1678570e58c0d8a6f71264f700615e8aaeb1..57708b73cd8d59345537c857c36281a64a736b83 100644 (file)
@@ -90,7 +90,7 @@ ascii <file-reader> xml>gb-data
 : lookup-range ( char -- byte-array )
     dup u>gb get-global interval-at [
         [ ufirst>> - ] [ bfirst>> ] bi + unlinear
-    ] [ encode-error ] if* ;
+    ] [ throw-encode-error ] if* ;
 
 M: gb18030 encode-char ( char stream encoding -- )
     drop [
index 9b2f3f44c5772941e15ef16a6ebb5940aaaf7f5b..d9b9a7f6cdd751cba3a6e31554f1b1b174523210 100644 (file)
@@ -44,7 +44,7 @@ CONSTANT: switch-jis212 B{ $ ESC CHAR: $ CHAR: ( CHAR: D }
         { [ dup jis201 get-global value? ] [ drop switch-jis201 jis201 get-global ] }
         { [ dup jis208 get-global value? ] [ drop switch-jis208 jis208 get-global ] }
         { [ dup jis212 get-global value? ] [ drop switch-jis212 jis212 get-global ] }
-        [ encode-error ]
+        [ throw-encode-error ]
     } cond ;
 
 : stream-write-num ( num stream -- )
index cd848cd6f833028d449921fbd42ed44e67f9485e..7b2001255ea72b4e9ecc9c34a934309a8301aa0c 100644 (file)
@@ -29,7 +29,7 @@ M: windows-31j <decoder> drop windows-31j-table get-global <decoder> ;
 
 TUPLE: jis assoc ;
 
-: ch>jis ( ch tuple -- jis ) assoc>> value-at [ encode-error ] unless* ;
+: ch>jis ( ch tuple -- jis ) assoc>> value-at [ throw-encode-error ] unless* ;
 : jis>ch ( jis tuple -- string ) assoc>> at replacement-char or ;
 
 : make-jis ( filename -- jis )
index bf1d5376eb5a63d9337de717fab37d33cbd28769..a82fdbeddea519a2d4200c348ee6ff0ebbb20248 100644 (file)
@@ -8,4 +8,4 @@ TUPLE: strict-state code ;
 C: strict strict-state
 
 M: strict-state decode-char
-    code>> decode-char dup replacement-char = [ decode-error ] when ;
+    code>> decode-char dup replacement-char = [ throw-decode-error ] when ;
index 362e02c6e75c4305aa2cb3185cfbae864a0156ea..8c5425c4108a7e9727d140dd0e974bee8ea28f6b 100644 (file)
@@ -31,7 +31,7 @@ SYNTAX: MACRO: (:) define-macro ;
 
 PREDICATE: macro < word "macro" word-prop >boolean ;
 
-M: macro make-inline cannot-be-inline ;
+M: macro make-inline throw-cannot-be-inline ;
 
 M: macro definer drop \ MACRO: \ ; ;
 
index b647c5b5c7d49a98b4c46e095ad926b5e19319ee..403a9bfbd844be83cf0e97636647161cb3ad79b4 100644 (file)
@@ -7,10 +7,10 @@ IN: tools.deploy
 ERROR: no-vocab-main vocab ;
 
 : check-vocab-main ( vocab -- vocab )
-    [ require ] keep dup vocab-main [ no-vocab-main ] unless ;
+    [ require ] keep dup vocab-main [ throw-no-vocab-main ] unless ;
 
 : deploy ( vocab -- )
-    dup find-vocab-root [ check-vocab-main deploy* ] [ no-vocab ] if ;
+    dup find-vocab-root [ check-vocab-main deploy* ] [ throw-no-vocab ] if ;
 
 : deploy-image-only ( vocab image -- )
     [ vm-path ] 2dip
index 1eb40445fe167cefa731bcfb471074793d511726..754a33c0ffee1ea49451cae4f0490a470a1d6abd 100644 (file)
@@ -25,10 +25,10 @@ ERROR: not-a-vocab-root string ;
 : contains-separator? ( string -- ? ) [ path-separator? ] any? ;
 
 : ensure-vocab-exists ( string -- string )
-    dup loaded-vocab-names member? [ no-vocab ] unless ;
+    dup loaded-vocab-names member? [ throw-no-vocab ] unless ;
 
 : check-root ( string -- string )
-    dup vocab-root? [ not-a-vocab-root ] unless ;
+    dup vocab-root? [ throw-not-a-vocab-root ] unless ;
 
 : check-vocab-root/vocab ( vocab-root string -- vocab-root string )
     [ check-root ] [ check-vocab-name ] bi* ;
index a89c581ea469f586af71f81c1243ae197ff48a23..7246afa06a95a7f8e9446fb2d2f771e4ca26625f 100644 (file)
@@ -8,7 +8,7 @@ vocabs.loader words ;
 IN: vocabs.metadata
 
 : check-vocab ( vocab -- vocab )
-    dup find-vocab-root [ no-vocab ] unless ;
+    dup find-vocab-root [ throw-no-vocab ] unless ;
 
 MEMO: vocab-file-contents ( vocab name -- seq )
     vocab-append-path dup
@@ -18,7 +18,7 @@ MEMO: vocab-file-contents ( vocab name -- seq )
     dupd vocab-append-path [
         swap [ ?delete-file ] [ swap utf8 set-file-lines ] if-empty
         \ vocab-file-contents reset-memoized
-    ] [ vocab-name no-vocab ] ?if ;
+    ] [ vocab-name throw-no-vocab ] ?if ;
 
 : vocab-windows-icon-path ( vocab -- string )
     vocab-dir "icon.ico" append-path ;
@@ -92,7 +92,7 @@ ERROR: bad-platform name ;
 
 : vocab-platforms ( vocab -- platforms )
     dup vocab-platforms-path vocab-file-contents
-    [ dup "system" lookup-word [ ] [ bad-platform ] ?if ] map ;
+    [ dup "system" lookup-word [ ] [ throw-bad-platform ] ?if ] map ;
 
 : set-vocab-platforms ( platforms vocab -- )
     [ [ name>> ] map ] dip
index b60331d8cb3b6ea6d4a01258cd0bfe60da2a1d5e..e02bc08a43380ebb98f2e4e93c9d774908aa759f 100755 (executable)
@@ -86,22 +86,22 @@ UNION: abi stdcall thiscall fastcall cdecl mingw ;
 ERROR: alien-callback-error ;
 
 : alien-callback ( return parameters abi quot -- alien )
-    alien-callback-error ;
+    throw-alien-callback-error ;
 
 ERROR: alien-indirect-error ;
 
 : alien-indirect ( args... funcptr return parameters abi -- return... )
-    alien-indirect-error ;
+    throw-alien-indirect-error ;
 
 ERROR: alien-invoke-error library symbol ;
 
 : alien-invoke ( args... return library function parameters -- return... )
-    2over alien-invoke-error ;
+    2over throw-alien-invoke-error ;
 
 ERROR: alien-assembly-error code ;
 
 : alien-assembly ( args... return parameters abi quot -- return... )
-    dup alien-assembly-error ;
+    dup throw-alien-assembly-error ;
 
 <PRIVATE
 
index 12017d64d84ffd7a4cab9702c8b3ef637d0c5c48..7e38ac31afaca6cfc76e616727771fa30eb61d6a 100644 (file)
@@ -22,7 +22,7 @@ M: f alien>string
 ERROR: invalid-c-string string ;
 
 : check-string ( string -- )
-    0 over member-eq? [ invalid-c-string ] [ drop ] if ;
+    0 over member-eq? [ throw-invalid-c-string ] [ drop ] if ;
 
 GENERIC# string>alien 1 ( string encoding -- byte-array )
 
index ad386c176e0b20d3c3c2541a2ce24dde54184128..c4b9cfc7fe21b94239e86c8896ce586de988013a 100644 (file)
@@ -17,12 +17,12 @@ ERROR: not-classoids sequence ;
 
 : check-classoids ( members -- members )
     dup [ classoid? ] all?
-    [ [ classoid? ] reject not-classoids ] unless ;
+    [ [ classoid? ] reject throw-not-classoids ] unless ;
 
 ERROR: not-a-classoid object ;
 
 : check-classoid ( object -- object )
-    dup classoid? [ not-a-classoid ] unless ;
+    dup classoid? [ throw-not-a-classoid ] unless ;
 
 : <anonymous-union> ( members -- classoid )
     check-classoids
@@ -47,7 +47,7 @@ TUPLE: anonymous-complement { class read-only } ;
 INSTANCE: anonymous-complement classoid
 
 : <anonymous-complement> ( object -- classoid )
-    dup classoid? [ 1array not-classoids ] unless
+    dup classoid? [ 1array throw-not-classoids ] unless
     anonymous-complement boa ;
 
 M: anonymous-complement rank-class drop 3 ;
@@ -283,7 +283,7 @@ ERROR: topological-sort-failed ;
 
 : largest-class ( seq -- n elt )
     dup [ [ class< ] with any? not ] curry find-last
-    [ topological-sort-failed ] unless* ;
+    [ throw-topological-sort-failed ] unless* ;
 
 : sort-classes ( seq -- newseq )
     [ class-name ] sort-with >vector
index 72178f62f2728bf4072c956e81a41e692098ea25..9a2469f70ba58607a14d2c83b00eaaad7693f47c 100644 (file)
@@ -12,7 +12,7 @@ PREDICATE: builtin-class < class
 ERROR: not-a-builtin object ;
 
 : check-builtin ( class -- )
-    dup builtin-class? [ drop ] [ not-a-builtin ] if ;
+    dup builtin-class? [ drop ] [ throw-not-a-builtin ] if ;
 
 : class>type ( class -- n ) "type" word-prop ; foldable
 
index 8c65a5d10b7dd667327aa2a7a093b37fff123a97..9e39b40923660d0d36c51ba516b46455cea9a0e3 100644 (file)
@@ -225,7 +225,7 @@ GENERIC: update-methods ( class seq -- )
     [ nip [ update-class ] each ] [ update-methods ] 2bi ;
 
 : check-inheritance ( subclass superclass -- )
-    2dup superclass-of? [ bad-inheritance ] [ 2drop ] if ;
+    2dup superclass-of? [ throw-bad-inheritance ] [ 2drop ] if ;
 
 : define-class ( word superclass members participants metaclass -- )
     [ 2dup check-inheritance ] 3dip
index bacb34a385661ad01b29ebda23037d5683bb1976..f73c1059a87c6b069aeb00a7a3a01c714830600d 100644 (file)
@@ -22,7 +22,7 @@ ERROR: check-mixin-class-error class ;
 
 : check-mixin-class ( mixin -- mixin )
     dup mixin-class? [
-        check-mixin-class-error
+        throw-check-mixin-class-error
     ] unless ;
 
 <PRIVATE
index 202214770b7cdfeff4c00380fddd589fac0b1ea3..7d02a5c0631804518d6374f483998e2e0261bf5c 100644 (file)
@@ -26,7 +26,7 @@ ERROR: duplicate-slot-names names ;
 
 : check-duplicate-slots ( slots -- )
     slot-names duplicates
-    [ duplicate-slot-names ] unless-empty ;
+    [ throw-duplicate-slot-names ] unless-empty ;
 
 ERROR: invalid-slot-name name ;
 
@@ -40,7 +40,7 @@ ERROR: invalid-slot-name name ;
     !
     ! : ...
     {
-        { [ dup { ":" "(" "<" "\"" "!" } member? ] [ invalid-slot-name ] }
+        { [ dup { ":" "(" "<" "\"" "!" } member? ] [ throw-invalid-slot-name ] }
         { [ 2dup = ] [ drop f ] }
         [ dup "{" = [ drop parse-long-slot-name ] when , t ]
     } cond nip ;
@@ -72,12 +72,12 @@ ERROR: bad-literal-tuple ;
 ERROR: bad-slot-name class slot ;
 
 : check-slot-name ( class slots name -- name )
-    2dup swap slot-named [ 2nip ] [ nip bad-slot-name ] if ;
+    2dup swap slot-named [ 2nip ] [ nip throw-bad-slot-name ] if ;
 
 : parse-slot-value ( class slots -- )
     scan-token check-slot-name scan-object 2array , scan-token {
         { "}" [ ] }
-        [ bad-literal-tuple ]
+        [ throw-bad-literal-tuple ]
     } case ;
 
 : (parse-slot-values) ( class slots -- )
@@ -85,7 +85,7 @@ ERROR: bad-slot-name class slot ;
     scan-token {
         { "{" [ (parse-slot-values) ] }
         { "}" [ 2drop ] }
-        [ 2nip bad-literal-tuple ]
+        [ 2nip throw-bad-literal-tuple ]
     } case ;
 
 : parse-slot-values ( class slots -- values )
@@ -97,7 +97,7 @@ M: tuple-class boa>object
     swap slots>tuple ;
 
 : check-slot-exists ( class initials slot-spec/f index/f name -- class initials slot-spec index )
-    over [ drop ] [ nip nip nip bad-slot-name ] if ;
+    over [ drop ] [ nip nip nip throw-bad-slot-name ] if ;
 
 : slot-named-checked ( class initials name slots -- class initials slot-spec )
     over [ slot-named* ] dip check-slot-exists drop ;
@@ -112,7 +112,7 @@ M: tuple-class boa>object
         { "f" [ drop \ } parse-until boa>object ] }
         { "{" [ 2dup parse-slot-values assoc>object ] }
         { "}" [ drop new ] }
-        [ bad-literal-tuple ]
+        [ throw-bad-literal-tuple ]
     } case ;
 
 : parse-tuple-literal ( -- tuple )
index 082a15d930b5f0ded72e5bdec80e3ecbcf5c748d..6d5b8750a9f243af25f1b3deb33ec13798bb931c 100644 (file)
@@ -602,61 +602,6 @@ must-fail-with
 
 { V{ } } [ blah ] unit-test
 
-! Test reshaping with type declarations and slot attributes
-TUPLE: reshape-test x ;
-
-T{ reshape-test f "hi" } "tuple" set
-
-{ } [ "IN: classes.tuple.tests TUPLE: reshape-test { x read-only } ;" eval( -- ) ] unit-test
-
-{ f } [ \ reshape-test \ x<< ?lookup-method ] unit-test
-
-[ "tuple" get 5 >>x ] must-fail
-
-{ "hi" } [ "tuple" get x>> ] unit-test
-
-{ } [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x integer read-only } ;" eval( -- ) ] unit-test
-
-{ 0 } [ "tuple" get x>> ] unit-test
-
-{ } [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x fixnum initial: 4 read-only } ;" eval( -- ) ] unit-test
-
-{ 0 } [ "tuple" get x>> ] unit-test
-
-TUPLE: boa-coercer-test { x array-capacity } ;
-
-{ fixnum } [ 0 >bignum boa-coercer-test boa x>> class-of ] unit-test
-
-{ T{ boa-coercer-test f 0 } } [ T{ boa-coercer-test } ] unit-test
-
-! Test error classes
-ERROR: error-class-test a b c ;
-
-{ "( a b c -- * )" } [ \ error-class-test stack-effect effect>string ] unit-test
-{ f } [ \ error-class-test "inline" word-prop ] unit-test
-
-[ "IN: classes.tuple.tests ERROR: error-x ; : error-x 3 ;" eval( -- ) ]
-[ error>> error>> redefine-error? ] must-fail-with
-
-DEFER: error-y
-
-{ } [ [ \ error-y dup class? [ forget-class ] [ drop ] if ] with-compilation-unit ] unit-test
-
-{ } [ "IN: classes.tuple.tests GENERIC: error-y ( a -- b )" eval( -- ) ] unit-test
-
-{ f } [ \ error-y tuple-class? ] unit-test
-
-{ f } [ \ error-y error-class? ] unit-test
-
-{ t } [ \ error-y generic? ] unit-test
-
-{ } [ "IN: classes.tuple.tests ERROR: error-y ;" eval( -- ) ] unit-test
-
-{ t } [ \ error-y tuple-class? ] unit-test
-
-{ t } [ \ error-y error-class? ] unit-test
-
-{ f } [ \ error-y generic? ] unit-test
 
 { } [
     "IN: classes.tuple.tests TUPLE: forget-subclass-test ; TUPLE: forget-subclass-test' < forget-subclass-test ;"
@@ -672,10 +617,12 @@ DEFER: error-y
     drop
 ] unit-test
 
+
 { } [
     "IN: sequences TUPLE: reversed { seq read-only } ;" eval( -- )
 ] unit-test
 
+
 TUPLE: bogus-hashcode-1 x ;
 
 TUPLE: bogus-hashcode-2 x ;
@@ -726,10 +673,33 @@ DEFER: redefine-tuple-twice
 
 { t } [ \ redefine-tuple-twice symbol? ] unit-test
 
-ERROR: base-error x y ;
-ERROR: derived-error < base-error z ;
 
-{ ( x y z -- * ) } [ \ derived-error stack-effect ] unit-test
+! Test reshaping with type declarations and slot attributes
+TUPLE: reshape-test x ;
+
+T{ reshape-test f "hi" } "tuple" set
+
+{ } [ "IN: classes.tuple.tests TUPLE: reshape-test { x read-only } ;" eval( -- ) ] unit-test
+
+{ f } [ \ reshape-test \ x<< ?lookup-method ] unit-test
+
+[ "tuple" get 5 >>x ] must-fail
+
+{ "hi" } [ "tuple" get x>> ] unit-test
+
+{ } [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x integer read-only } ;" eval( -- ) ] unit-test
+
+{ 0 } [ "tuple" get x>> ] unit-test
+
+{ } [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x fixnum initial: 4 read-only } ;" eval( -- ) ] unit-test
+
+{ 0 } [ "tuple" get x>> ] unit-test
+
+TUPLE: boa-coercer-test { x array-capacity } ;
+
+{ fixnum } [ 0 >bignum boa-coercer-test boa x>> class-of ] unit-test
+
+{ T{ boa-coercer-test f 0 } } [ T{ boa-coercer-test } ] unit-test
 
 ! Make sure that tuple reshaping updates code heap roots
 TUPLE: code-heap-ref ;
index 5addf3a98d91c8492a3d3c3ec10a93ef3c1583e2..6c1bcf75275f7f9b90294358fba1de2a4357feb3 100644 (file)
@@ -3,8 +3,8 @@
 USING: accessors arrays assocs classes classes.algebra
 classes.algebra.private classes.builtin classes.private
 combinators definitions effects generic kernel kernel.private
-make math math.private memory namespaces quotations sequences
-sequences.private slots slots.private strings words ;
+make math math.private memory namespaces quotations
+sequences sequences.private slots slots.private strings words ;
 IN: classes.tuple
 
 <PRIVATE
@@ -24,7 +24,7 @@ ERROR: no-slot name tuple ;
 
 : offset-of-slot ( name tuple -- n )
     2dup class-of all-slots slot-named
-    [ 2nip offset>> ] [ no-slot ] if* ;
+    [ 2nip offset>> ] [ throw-no-slot ] if* ;
 
 : get-slot-named ( name tuple -- value )
     [ nip ] [ offset-of-slot ] 2bi slot ;
@@ -59,7 +59,7 @@ M: tuple class-of layout-of 2 slot { word } declare ; inline
     [ [ layout-of ] [ class-of tuple-layout ] bi eq? ] [ drop t ] if ;
 
 : check-tuple ( object -- tuple )
-    dup tuple? [ not-a-tuple ] unless ; inline
+    dup tuple? [ throw-not-a-tuple ] unless ; inline
 
 : prepare-tuple-slots ( tuple -- n tuple )
     check-tuple [ tuple-size iota ] keep ;
@@ -318,32 +318,13 @@ M: tuple-class (define-tuple-class)
     3dup tuple-class-unchanged?
     [ 2drop ?define-symbol ] [ redefine-tuple-class ] if ;
 
-PREDICATE: error-class < tuple-class
-    "error-class" word-prop ;
-
-M: error-class reset-class
-    [ call-next-method ] [ "error-class" remove-word-prop ] bi ;
-
-: define-error-class ( class superclass slots -- )
-    error-slots {
-        [ define-tuple-class ]
-        [ 2drop reset-generic ]
-        [ 2drop t "error-class" set-word-prop ]
-        [
-            2drop
-            [ dup [ boa throw ] curry ]
-            [ all-slots thrower-effect ]
-            bi define-declared
-        ]
-    } 3cleave ;
-
 : boa-effect ( class -- effect )
     [ all-slots [ name>> ] map ] [ name>> 1array ] bi <effect> ;
 
 ERROR: not-a-tuple-class object ;
 
 : check-tuple-class ( class -- class )
-    dup tuple-class? [ not-a-tuple-class ] unless ; inline
+    dup tuple-class? [ throw-not-a-tuple-class ] unless ; inline
 
 : define-boa-word ( word class -- )
     check-tuple-class [ [ boa ] curry ] [ boa-effect ] bi
index 0e4cf5742a44ea3773c53632c9ac42e2aa2138c0..b375b20b4ca0137cacde7ac2d4589ebbee56314e 100644 (file)
@@ -68,7 +68,7 @@ M: object classes-contained-by
         dup dup [ classes-contained-by ] map concat sift append
         2dup set= [ 2drop f ] [ nip ] if
     ] follow concat
-    member-eq? [ cannot-reference-self ] when ;
+    member-eq? [ throw-cannot-reference-self ] when ;
 
 PRIVATE>
 
index c64c57b14aab476dcd5342d9fa9c57c5e52f616e..ef855bfd374b9477b6ee7bb5e9a3b7e3021f3d6f 100644 (file)
@@ -38,7 +38,7 @@ SLOT: terminated?
             check-datastack
         ] if
     ] 2dip rot
-    [ 2drop ] [ wrong-values ] if ;
+    [ 2drop ] [ throw-wrong-values ] if ;
 
 : execute-effect ( word effect -- )
     [ [ execute ] curry ] dip call-effect ;
index 292a0b5bc810eca547bc6b5d21a12d712fdfa3ec..8e43e486691662f7fc0a16355f7b655572231a35 100644 (file)
@@ -52,7 +52,7 @@ C: <continuation> continuation
 ERROR: not-a-continuation object ;
 
 : >continuation< ( continuation -- data call retain name catch )
-    dup continuation? [ not-a-continuation ] unless
+    dup continuation? [ throw-not-a-continuation ] unless
     { [ data>> ] [ call>> ] [ retain>> ] [ name>> ] [ catch>> ] } cleave ; inline
 
 PRIVATE>
index 350268630ca8ac57a960a5a452050772837440f8..4fdae1da75649c4108eb12d8764f5e6e700804a0 100644 (file)
@@ -8,7 +8,7 @@ MIXIN: definition-mixin
 ERROR: no-compilation-unit definition ;
 
 : add-to-unit ( key set -- )
-    [ adjoin ] [ no-compilation-unit ] if* ;
+    [ adjoin ] [ throw-no-compilation-unit ] if* ;
 
 SYMBOL: changed-definitions
 
index 3e4eaeeec992c44ea31b19221d1d0d221e25e633..fc79a193df5af33bdf2f2854d76afc7d5c1d3400 100755 (executable)
@@ -19,7 +19,7 @@ SLOT: continuation
     disposables get adjoin ;
 
 : unregister-disposable ( obj -- )
-    disposables get 2dup in? [ delete ] [ drop already-unregistered ] if ;
+    disposables get 2dup in? [ delete ] [ drop throw-already-unregistered ] if ;
 
 PRIVATE>
 
index c1288052b1c25ac114fe0a7b5067a15d7f646ffc..2e9d6683219d32608ef5e5f662c36d258c1261da 100644 (file)
@@ -132,4 +132,4 @@ ERROR: bad-stack-effect word expected got ;
 
 : check-stack-effect ( word effect -- )
     over stack-effect 2dup effect=
-    [ 3drop ] [ bad-stack-effect ] if ;
+    [ 3drop ] [ throw-bad-stack-effect ] if ;
index 2a9246c1b234ebad14962bfb7f2644b91604fa94..aed4e2f3ea0e1ff445a29a61758a578034ad50af 100644 (file)
@@ -21,8 +21,8 @@ SYMBOL: effect-var
 
 : parse-effect-var ( first? var name -- var )
     nip
-    [ ":" ?tail [ row-variable-can't-have-type ] when ] curry
-    [ invalid-row-variable ] if ;
+    [ ":" ?tail [ throw-row-variable-can't-have-type ] when ] curry
+    [ throw-invalid-row-variable ] if ;
 
 : parse-effect-value ( token -- value )
     ":" ?tail [ scan-object 2array ] when ;
@@ -31,8 +31,8 @@ PRIVATE>
 : parse-effect-token ( first? var end -- var more? )
     scan-token {
         { [ end-token? ] [ drop nip f ] }
-        { [ effect-opener? ] [ bad-effect ] }
-        { [ effect-closer? ] [ stack-effect-omits-dashes ] }
+        { [ effect-opener? ] [ throw-bad-effect ] }
+        { [ effect-closer? ] [ throw-stack-effect-omits-dashes ] }
         { [ row-variable? ] [ parse-effect-var t ] }
         [ [ drop ] 2dip parse-effect-value , t ]
     } cond ;
index c861f7c54bc894dd9c3c90fd1711f5ceae24f75d..cd773a89f1167467db9749aa715ea43eff8fca53 100644 (file)
@@ -30,7 +30,7 @@ ERROR: method-lookup-failed class generic ;
     "methods" word-prop at ;
 
 : lookup-method ( class generic -- method )
-    2dup ?lookup-method [ 2nip ] [ method-lookup-failed ] if* ;
+    2dup ?lookup-method [ 2nip ] [ throw-method-lookup-failed ] if* ;
 
 <PRIVATE
 
index 96a3edf9c62c51dc34079cbfc3a5689a46ed0cdb..6b320bbf624d59f9d1297efb5398e589427f1eb0 100644 (file)
@@ -45,7 +45,7 @@ PRIVATE>
 ERROR: no-math-method left right generic ;
 
 : default-math-method ( generic -- quot )
-    [ no-math-method ] curry [ ] like ;
+    [ throw-no-math-method ] curry [ ] like ;
 
 <PRIVATE
 
index 77533de629cba040d88451aa701c3e885672da32..61c9136f178b8f9e38f4855f3ccd9341c03859db 100644 (file)
@@ -38,7 +38,7 @@ SYMBOL: current-method
 ERROR: bad-method-effect ;
 
 : check-method-effect ( effect -- )
-    last-word generic-effect method-effect= [ bad-method-effect ] unless ;
+    last-word generic-effect method-effect= [ throw-bad-method-effect ] unless ;
 
 : ?execute-parsing ( word/number -- seq )
     dup parsing-word?
index 7978434c92b5ad7b83ee8c19b7e486be3a0503c3..cb0d7b547d47b214ccfd3eb001d4f1acd65e2286 100644 (file)
@@ -23,7 +23,7 @@ TUPLE: single-combination ;
 PREDICATE: single-generic < generic
     "combination" word-prop single-combination? ;
 
-M: single-generic make-inline cannot-be-inline ;
+M: single-generic make-inline throw-cannot-be-inline ;
 
 GENERIC: dispatch# ( word -- n )
 
@@ -45,7 +45,7 @@ M: single-combination next-method-quot* ( class generic combination -- quot )
             [
                 pick predicate-def %
                 1quotation ,
-                [ inconsistent-next-method ] 2curry ,
+                [ throw-inconsistent-next-method ] 2curry ,
                 \ if ,
             ] [ ] make picker prepend
         ] [ 3drop f ] if
@@ -59,7 +59,7 @@ M: single-combination next-method-quot* ( class generic combination -- quot )
     bi or ;
 
 M: single-combination make-default-method
-    [ [ picker ] dip [ no-method ] curry append ] with-combination ;
+    [ [ picker ] dip [ throw-no-method ] curry append ] with-combination ;
 
 ! ! ! Build an engine ! ! !
 
@@ -216,7 +216,7 @@ ERROR: unreachable ;
 
 : prune-redundant-predicates ( assoc -- default assoc' )
     {
-        { [ dup empty? ] [ drop [ unreachable ] { } ] }
+        { [ dup empty? ] [ drop [ throw-unreachable ] { } ] }
         { [ dup length 1 = ] [ first second { } ] }
         { [ dup keep-going? ] [ rest-slice prune-redundant-predicates ] }
         [ [ first second ] [ rest-slice ] bi ]
index 0f6ad5919cd749b9a648a84910b2d23162e63dc8..6efa706c4929e64c8d074a2768b3f2d03a16ac50 100644 (file)
@@ -194,7 +194,7 @@ M: hashtable assoc-like
 ERROR: malformed-hashtable-pair seq pair ;
 
 : check-hashtable ( seq -- seq )
-    dup [ dup length 2 = [ drop ] [ malformed-hashtable-pair ] if ] each ;
+    dup [ dup length 2 = [ drop ] [ throw-malformed-hashtable-pair ] if ] each ;
 
 : parse-hashtable ( seq -- hashtable )
     check-hashtable H{ } assoc-clone-like ;
index 2c7a475217c1b2c9d7e15b4b30e1cc11a653cf34..7b7e3e1a3ec8d57417fbfb4dfc1ff16fcacb36b3 100644 (file)
@@ -8,7 +8,7 @@ SINGLETON: ascii
 
 M: ascii encode-char
     drop
-    over 127 <= [ stream-write1 ] [ encode-error ] if ; inline
+    over 127 <= [ stream-write1 ] [ throw-encode-error ] if ; inline
 
 <PRIVATE
 
@@ -16,7 +16,7 @@ GENERIC: ascii> ( string -- byte-array )
 
 M: string ascii>
     dup aux>>
-    [ [ dup 127 <= [ encode-error ] unless ] B{ } map-as ]
+    [ [ dup 127 <= [ throw-encode-error ] unless ] B{ } map-as ]
     [ string>byte-array-fast ] if ; inline
 
 PRIVATE>
index 0660ddfd774784118e80c769c5e357eb9e6c1fb7..13406a23f16ad87567ff8cc979e20fb62b591c43 100644 (file)
@@ -139,7 +139,7 @@ CONSTANT: bom-be B{ 0xfe 0xff }
 
 : bom>le/be ( bom -- le/be )
     dup bom-le sequence= [ drop utf16le ] [
-        bom-be sequence= [ utf16be ] [ missing-bom ] if
+        bom-be sequence= [ utf16be ] [ throw-missing-bom ] if
     ] if ;
 
 M: utf16 <decoder> ( stream utf16 -- decoder )
index 2d382e49d18342fb76cd6b7ccdba2d0beef4cd6c..d96bcf6d20ad2851d1896581bc297cf53efb5cb4 100644 (file)
@@ -35,7 +35,7 @@ ERROR: no-parent-directory path ;
             drop "." swap
         ] if
         { "" "." ".." } member? [
-            no-parent-directory
+            throw-no-parent-directory
         ] when
     ] unless ;
 
@@ -57,7 +57,7 @@ ERROR: no-parent-directory path ;
         { [ dup head.? ] [
             rest trim-head-separators append-path-empty
         ] }
-        { [ dup head..? ] [ drop no-parent-directory ] }
+        { [ dup head..? ] [ drop throw-no-parent-directory ] }
         [ nip ]
     } cond ;
 
index d73d480d80f6184e46b6e2443195b1eb5e991697..50a0bededfd3d6e0f77f4d53173b9ed9de63ca44 100644 (file)
@@ -304,7 +304,7 @@ GENERIC: throw ( error -- * )
 
 ERROR: assert got expect ;
 
-: assert= ( a b -- ) 2dup = [ 2drop ] [ assert ] if ;
+: assert= ( a b -- ) 2dup = [ 2drop ] [ throw-assert ] if ;
 
 <PRIVATE
 
index 55ae061633b9e3d3eaf0da6dc5aa20d078ebe01c..1676b8acf7d0491d2d6c544e359f44b799211f11 100644 (file)
@@ -18,7 +18,7 @@ TUPLE: lexer-parsing-word word line line-text column ;
 ERROR: not-a-lexer object ;
 
 : check-lexer ( lexer -- lexer )
-    dup lexer? [ not-a-lexer ] unless ; inline
+    dup lexer? [ throw-not-a-lexer ] unless ; inline
 
 : next-line ( lexer -- )
     check-lexer
index ecf3e43001606fc82569469bf1893bc746f3faa4..b0dd45885bbb7d8d09606fdffe48453fe8146566 100644 (file)
@@ -134,7 +134,7 @@ PRIVATE>
 ERROR: log2-expects-positive x ;
 
 : log2 ( x -- n )
-    dup 0 <= [ log2-expects-positive ] [ (log2) ] if ; inline
+    dup 0 <= [ throw-log2-expects-positive ] [ (log2) ] if ; inline
 
 : zero? ( x -- ? ) 0 number= ; inline
 : 2/ ( x -- y ) -1 shift ; inline
index de8f60ce1d71541c55730b807a2b84d2297bfffc..4cc773e0eea42c3510deac5ece1a469738efb1ce 100644 (file)
@@ -454,7 +454,7 @@ M: fixnum (positive>dec)
     1 over (count-digits) <sbuf> (fixnum>dec) "" like reverse! nip ; inline
 
 : (positive>base) ( num radix -- str )
-    dup 1 <= [ invalid-radix ] when
+    dup 1 <= [ throw-invalid-radix ] when
     [ dup 0 > ] swap [ /mod >digit ] curry "" produce-as nip
     reverse! ; inline
 
@@ -534,7 +534,7 @@ M: ratio >base
         { 16 [ [ float>hex-value ] swap (bin-float>base) ] }
         { 8  [ [ float>oct-value ] swap (bin-float>base) ] }
         { 2  [ [ float>bin-value ] swap (bin-float>base) ] }
-        [ invalid-radix ]
+        [ throw-invalid-radix ]
     } case ;
 
 : format-string ( format -- format )
index 167d335b9bac0f2635e936c70231edff29756739..71d0aebcc995ca2b81ef344fabc8981a6d4a607f 100644 (file)
@@ -26,7 +26,7 @@ ERROR: division-by-zero x ;
 
 M: integer /
     [
-        division-by-zero
+        throw-division-by-zero
     ] [
         dup 0 < [ [ neg ] bi@ ] when
         2dup fast-gcd [ /i ] curry bi@ fraction>
@@ -34,7 +34,7 @@ M: integer /
 
 M: integer recip
     1 swap [
-        division-by-zero
+        throw-division-by-zero
     ] [
         dup 0 < [ [ neg ] bi@ ] when fraction>
     ] if-zero ;
index 91dea25487cef3ca6e6f88bce90695987cb3684d..990d00d9f2c515e1e67659a23a5f657bec235761 100644 (file)
@@ -53,7 +53,7 @@ SYMBOL: auto-use?
 ERROR: number-expected ;
 
 : parse-number ( string -- number )
-    string>number [ number-expected ] unless* ;
+    string>number [ throw-number-expected ] unless* ;
 
 : parse-datum ( string -- word/number )
     dup search [ ] [
@@ -77,7 +77,7 @@ ERROR: invalid-word-name string ;
 : scan-word-name ( -- string )
     scan-token
     dup "\"" = [ t ] [ dup string>number ] if
-    [ invalid-word-name ] when ;
+    [ throw-invalid-word-name ] when ;
 
 : scan-new ( -- word )
     scan-word-name create-word-in ;
@@ -93,7 +93,7 @@ ERROR: staging-violation word ;
     pop-parsing-word ; inline
 
 : execute-parsing ( accum word -- accum )
-    dup changed-definitions get in? [ staging-violation ] when
+    dup changed-definitions get in? [ throw-staging-violation ] when
     (execute-parsing) ;
 
 : scan-object ( -- object )
index a2ab3ee8e2dc90699641b90820af5d0bea1f771c..d5d6ddc3d005ed2e349d08ddd4cb4e2fcf09e380 100644 (file)
@@ -57,13 +57,13 @@ M: integer bounds-check? ( n seq -- ? )
     dupd length < [ 0 >= ] [ drop f ] if ; inline
 
 : bounds-check ( n seq -- n seq )
-    2dup bounds-check? [ bounds-error ] unless ; inline
+    2dup bounds-check? [ throw-bounds-error ] unless ; inline
 
 MIXIN: immutable-sequence
 
 ERROR: immutable element index sequence ;
 
-M: immutable-sequence set-nth immutable ;
+M: immutable-sequence set-nth throw-immutable ;
 
 INSTANCE: immutable-sequence sequence
 
@@ -304,7 +304,7 @@ C: <copy> copy-state
     3dup nip new-sequence 0 swap <copy> ; inline
 
 : bounds-check-head ( n seq -- n seq )
-    over 0 < [ bounds-error ] when ; inline
+    over 0 < [ throw-bounds-error ] when ; inline
 
 : check-copy ( src n dst -- src n dst )
     3dup bounds-check-head
@@ -742,7 +742,7 @@ PRIVATE>
 
 : last ( seq -- elt )
     [ length 1 - ] keep
-    over 0 < [ bounds-error ] [ nth-unsafe ] if ; inline
+    over 0 < [ throw-bounds-error ] [ nth-unsafe ] if ; inline
 
 <PRIVATE
 
@@ -753,7 +753,7 @@ PRIVATE>
 
 : set-last ( elt seq -- )
     [ length 1 - ] keep
-    over 0 < [ bounds-error ] [ set-nth-unsafe ] if ; inline
+    over 0 < [ throw-bounds-error ] [ set-nth-unsafe ] if ; inline
 
 : pop* ( seq -- ) [ length 1 - ] [ shorten ] bi ;
 
@@ -814,7 +814,7 @@ PRIVATE>
 : pop ( seq -- elt )
     [ length 1 - ] keep over 0 >=
     [ [ nth-unsafe ] [ shorten ] 2bi ]
-    [ bounds-error ] if ;
+    [ throw-bounds-error ] if ;
 
 : exchange ( m n seq -- )
     [ nip bounds-check 2drop ]
index e3f6ea995bea0d863bc354005b571b4c1440387e..22d3e1068e3c5c1aa79d009280834c9c55c155bf 100644 (file)
@@ -83,7 +83,7 @@ M: object instance-check-quot
     [
         \ dup ,
         [ predicate-def % ]
-        [ [ bad-slot-value ] curry , ] bi
+        [ [ throw-bad-slot-value ] curry , ] bi
         \ unless ,
     ] [ ] make ;
 
@@ -241,7 +241,7 @@ ERROR: bad-slot-attribute key ;
         unclip {
             { initial: [ [ first >>initial ] [ rest ] bi ] }
             { read-only [ [ t >>read-only ] dip ] }
-            [ bad-slot-attribute ]
+            [ throw-bad-slot-attribute ]
         } case
     ] unless ;
 
index 2575ea686ff495b9c7d4f4c80aff9c9e83f960ff..dbdd042778fec91bf3175a973ed5e7e8dc3a95a5 100644 (file)
@@ -33,7 +33,7 @@ main ;
 ERROR: invalid-source-file-path path ;
 
 : path>source-file ( path -- source-file )
-    dup string? [ invalid-source-file-path ] unless
+    dup string? [ throw-invalid-source-file-path ] unless
     source-files get [ <source-file> ] cache ;
 
 : reset-checksums ( -- )
index 771b31ac547a0412744c3dbd0c546c581bd8e174..86f6030b05760ba978388235c5140e6fdf10ed0f 100644 (file)
@@ -22,7 +22,7 @@ ERROR: bad-escape char ;
         { CHAR: 0  CHAR: \0 }
         { CHAR: \\ CHAR: \\ }
         { CHAR: \" CHAR: \" }
-    } ?at [ bad-escape ] unless ;
+    } ?at [ throw-bad-escape ] unless ;
 
 SYMBOL: name>char-hook
 
@@ -116,7 +116,7 @@ ERROR: escaped-char-expected ;
     dup still-parsing-line? [
         [ current-char ] [ advance-char ] bi
     ] [
-        escaped-char-expected
+        throw-escaped-char-expected
     ] if ;
 
 : lexer-head? ( lexer string -- ? )
@@ -175,8 +175,6 @@ DEFER: (parse-multiline-string-until)
         ] if
     ] if ;
 
-ERROR: trailing-characters string ;
-
 : (parse-multiline-string-until) ( accum lexer string -- )
     { sbuf lexer fixnum } declare
     over still-parsing? [
index d381685cec106a701ebbcbf1e7cdcbabf814c923..9b9b47f542ad6d2a2b4e8dc08f45c49957683f27 100644 (file)
@@ -823,15 +823,15 @@ HELP: SLOT:
 HELP: ERROR:
 { $syntax "ERROR: class slots... ;" }
 { $values { "class" "a new tuple class to define" } { "slots" "a list of slot names" } }
-{ $description "Defines a new tuple class whose class word throws a new instance of the error." }
+{ $description "Defines a new tuple class and a word " { $snippet "throw-classname" } " that throws a new instance of the error." }
 { $notes
     "The following two snippets are equivalent:"
     { $code
         "ERROR: invalid-values x y ;"
         ""
         "TUPLE: invalid-values x y ;"
-        ": invalid-values ( x y -- * )"
-        "    \\ invalid-values boa throw ;"
+        ": throw-invalid-values ( x y -- * )"
+        "    invalid-values boa throw ;"
     }
 } ;
 
index 4ffd70b3848f001f883cca01491816ad54ece4a3..8a993646757793aea23b084bc415775eebcffaef 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays byte-arrays byte-vectors
-classes.algebra.private classes.builtin classes.intersection
-classes.maybe classes.mixin classes.parser classes.predicate
-classes.singleton classes.tuple classes.tuple.parser
+classes.algebra.private classes.builtin classes.error
+classes.intersection classes.maybe classes.mixin classes.parser
+classes.predicate classes.singleton classes.tuple classes.tuple.parser
 classes.union combinators compiler.units definitions effects
 effects.parser generic generic.hook generic.math generic.parser
 generic.standard hash-sets hashtables io.pathnames kernel lexer
@@ -31,7 +31,7 @@ IN: bootstrap.syntax
 
 : define-core-syntax ( name quot -- )
     [
-        dup "syntax" lookup-word [ ] [ no-word-error ] ?if
+        dup "syntax" lookup-word [ ] [ throw-no-word-error ] ?if
         mark-top-level-syntax
     ] dip
     define-syntax ;
@@ -261,7 +261,7 @@ IN: bootstrap.syntax
             literalize suffix!
             \ (call-next-method) suffix!
         ] [
-            not-in-a-method-error
+            throw-not-in-a-method-error
         ] if*
     ] define-core-syntax
 
index 520ee419455e5a6c31cfe31b3fc6dcb5de4fb982..e17f85461b9c75763b77c3820e7f65061a47c313 100755 (executable)
@@ -93,7 +93,7 @@ HELP: find-vocab-root
 
 HELP: no-vocab
 { $values { "name" "a vocabulary name" } }
-{ $description "Throws a " { $link no-vocab } "." }
+{ $description "A " { $link no-vocab } " error tuple. Call " { $link throw-no-vocab } " to throw it." }
 { $error-description "Thrown when a " { $link POSTPONE: USE: } " or " { $link POSTPONE: USING: } " form refers to a non-existent vocabulary." } ;
 
 HELP: load-help?
index 1de8ecabd5f974952607030b6608a0f8e8851e5f..17de3f26d402f9e72fd843c8a819c49891a37bd2 100644 (file)
@@ -36,7 +36,7 @@ ERROR: not-found-in-roots path ;
     vocab-roots get [ prepend-path exists? ] with find nip ;
 
 M: string vocab-path ( string -- path/f )
-    dup find-root-for [ prepend-path ] [ not-found-in-roots ] if* ;
+    dup find-root-for [ prepend-path ] [ throw-not-found-in-roots ] if* ;
 
 PRIVATE>
 
@@ -165,7 +165,7 @@ PRIVATE>
     [
         drop dup find-vocab-root
         [ (require) ]
-        [ dup lookup-vocab [ drop ] [ no-vocab ] if ]
+        [ dup lookup-vocab [ drop ] [ throw-no-vocab ] if ]
         if
     ] if
 ] require-hook set-global
index 5cf59fdaf5ed59b037595d56f13461dff4c43d72..f7a18a2c53903249e822db237008543b146beeca 100644 (file)
@@ -58,7 +58,7 @@ ERROR: no-word-in-vocab word vocab ;
 
 : extract-words ( seq vocab -- assoc )
     [ words>> extract-keys dup ] [ name>> ] bi
-    [ swap [ 2drop ] [ no-word-in-vocab ] if ] curry assoc-each ;
+    [ swap [ 2drop ] [ throw-no-word-in-vocab ] if ] curry assoc-each ;
 
 : excluding-words ( seq vocab -- assoc )
     [ nip words>> ] [ extract-words ] 2bi assoc-diff ;
@@ -98,13 +98,13 @@ ERROR: unbalanced-private-declaration vocab ;
 
 : begin-private ( -- )
     current-vocab name>> ".private" ?tail
-    [ unbalanced-private-declaration ]
+    [ throw-unbalanced-private-declaration ]
     [ ".private" append set-current-vocab ] if ;
 
 : end-private ( -- )
     current-vocab name>> ".private" ?tail
     [ set-current-vocab ]
-    [ unbalanced-private-declaration ] if ;
+    [ throw-unbalanced-private-declaration ] if ;
 
 : using-vocab? ( vocab -- ? )
     vocab-name manifest get search-vocab-names>> in? ;
@@ -161,7 +161,7 @@ TUPLE: rename word vocab words ;
 : <rename> ( word vocab new-name -- rename )
     [
         2dup load-vocab words>> dupd at
-        [ ] [ swap no-word-in-vocab ] ?if
+        [ ] [ swap throw-no-word-in-vocab ] ?if
     ] dip associate rename boa ;
 
 : add-renamed-word ( word vocab new-name -- )
index 66f706eac72c9489b9f83549eb822f53f30c2b36..a3389cd2ea1655d8dd6379065ebba4ef8ce8d41b 100644 (file)
@@ -24,8 +24,8 @@ SYMBOL: +done+
 ERROR: bad-vocab-name name ;
 
 : check-vocab-name ( name -- name )
-    dup string? [ bad-vocab-name ] unless
-    dup [ ":/\\ " member? ] any? [ bad-vocab-name ] when ;
+    dup string? [ throw-bad-vocab-name ] unless
+    dup [ ":/\\ " member? ] any? [ throw-bad-vocab-name ] when ;
 
 TUPLE: vocab-link name ;
 
index 91a3a517ef9f247c5ebd42d74dc3dd3b30130d47..c9123b6f8227417fc4683bb7c4bf2c07e8e4516c 100644 (file)
@@ -80,7 +80,7 @@ ERROR: invalid-primitive vocabulary word effect ;
     [ drop vocabulary>> = ]
     [ drop nip primitive? ]
     [ [ nip "declared-effect" word-prop ] dip = ] 3tri and and
-    [ 3drop ] [ invalid-primitive ] if ;
+    [ 3drop ] [ throw-invalid-primitive ] if ;
 
 : lookup-word ( name vocab -- word ) vocab-words-assoc at ;
 
@@ -216,13 +216,13 @@ M: word reset-word
 
 : reveal ( word -- )
     dup [ name>> ] [ vocabulary>> ] bi dup vocab-words-assoc
-    [ ] [ no-vocab ] ?if set-at ;
+    [ ] [ throw-no-vocab ] ?if set-at ;
 
 ERROR: bad-create name vocab ;
 
 : check-create ( name vocab -- name vocab )
     2dup [ string? ] [ [ string? ] [ vocab? ] bi or ] bi* and
-    [ bad-create ] unless ;
+    [ throw-bad-create ] unless ;
 
 : create-word ( name vocab -- word )
     check-create 2dup lookup-word