diff --git a/basis/prettyprint/prettyprint.factor b/basis/prettyprint/prettyprint.factor index a045dbdfa9..48902f8d0a 100644 --- a/basis/prettyprint/prettyprint.factor +++ b/basis/prettyprint/prettyprint.factor @@ -35,6 +35,9 @@ IN: prettyprint : short. ( obj -- ) pprint-short nl ; +: pprint-error ( obj -- str ) + class-of name>> "~pprint error: " "~" surround ; + : .b ( n -- ) >bin print ; : .o ( n -- ) >oct print ; : .h ( n -- ) >hex print ; @@ -42,9 +45,7 @@ IN: prettyprint : stack. ( seq -- ) [ [ short. ] [ - drop - [ class-of name>> "~pprint error: " "~" surround ] - keep write-object nl + drop [ pprint-error ] keep write-object nl ] recover ] each ; diff --git a/basis/ui/tools/traceback/traceback.factor b/basis/ui/tools/traceback/traceback.factor index 3bfa9b3233..06d2fbe719 100644 --- a/basis/ui/tools/traceback/traceback.factor +++ b/basis/ui/tools/traceback/traceback.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2006, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays classes continuations fonts fry -inspector kernel models models.arrow prettyprint sequences -ui.commands ui.gadgets ui.gadgets.borders ui.gadgets.buttons +USING: accessors arrays continuations fonts fry inspector +kernel models models.arrow prettyprint sequences ui.commands +ui.gadgets ui.gadgets.borders ui.gadgets.buttons ui.gadgets.labeled ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.tables ui.gadgets.tracks ui.gestures ui.tools.common ; @@ -12,9 +12,8 @@ IN: ui.tools.traceback TUPLE: stack-entry object string ; : ( object -- stack-entry ) - dup [ unparse-short ] [ - drop class-of name>> "~pprint error: " "~" surround - ] recover stack-entry boa ; + dup [ unparse-short ] [ drop pprint-error ] recover + stack-entry boa ; SINGLETON: stack-entry-renderer