Hide error when merging a new item
[scpubgit/stemmaweb.git] / lib / stemmaweb / Controller / Relation.pm
index a8e63d0..12c63ef 100644 (file)
@@ -9,15 +9,6 @@ use TryCatch;
 
 BEGIN { extends 'Catalyst::Controller' }
 
-
-sub throw {
-       Text::Tradition::Error->throw(
-               'ident' => 'Collation error',
-               'message' => $_[0],
-               );
-}
-
-
 =head1 NAME
 
 stemmaweb::Controller::Relation - Controller for the relationship mapper
@@ -508,16 +499,16 @@ sub compress :Chained('text') :PathPart :Args(0) {
                        # Finally, make sure we haven't screwed anything up.
                        foreach my $wit ( $tradition->witnesses ) {
                                my $pathtext = $collation->path_text( $wit->sigil );
-                               throw( "Text differs for witness " . $wit->sigil )
+                               Text::Tradition::Error->throw_collation_error( "Text differs for witness " . $wit->sigil )
                                        unless $pathtext eq $origtext{$wit->sigil};
                                if( $wit->is_layered ) {
                                        my $acsig = $wit->sigil . $collation->ac_label;
                                        $pathtext = $collation->path_text( $acsig );
-                                       throw( "Layered text differs for witness " . $wit->sigil )
+                                       Text::Tradition::Error->throw_collation_error( "Layered text differs for witness " . $wit->sigil )
                                                unless $pathtext eq $origtext{$acsig};
                                }
                        }
-               } catch ($e) {
+               } catch (Text::Tradition::Error $e) {
                        $c->stash->{result} = {
                                error_msg => $e->message,
                        };