From: Errietta Kostala Date: Wed, 10 Jun 2015 15:34:24 +0000 (+0000) Subject: Hide error when merging a new item X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=32f1389102b080b2ce404b57d9612daa601866e8;p=scpubgit%2Fstemmaweb.git Hide error when merging a new item --- diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index a8e63d0..12c63ef 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -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, }; diff --git a/root/js/relationship.js b/root/js/relationship.js index f011bc6..79162d9 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -1325,7 +1325,10 @@ $(document).ready(function () { width: 250, modal: true, buttons: { - Cancel: function() { $( this ).dialog( "close" ); }, + Cancel: function() { + document.getElementById('duplicate-merge-error').innerHTML = ""; + $( this ).dialog( "close" ); + }, Detach: function ( evt ) { evt.target.id = 'detach_btn'; @@ -1352,6 +1355,8 @@ $(document).ready(function () { var jqjson = $.post(ncpath, form_values, function(data) { if (data.success) { + document.getElementById('duplicate-merge-error').innerHTML = ""; + if (data.nodes) { compress_nodes(data.nodes); }