Commit f62b99e1 authored by Leo Gordon's avatar Leo Gordon
Browse files

Switched to our internal implementation of throw() via Carp::confess. It is...

Switched to our internal implementation of throw() via Carp::confess. It is also available to Runnables as $self->throw( $msg );
parent b338200d
......@@ -43,8 +43,7 @@ package Bio::EnsEMBL::Hive::AnalysisCtrlRule;
use strict;
use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::Utils ('throw');
use Bio::EnsEMBL::Hive::URLFactory;
use base ( 'Bio::EnsEMBL::Hive::Storable' );
......
......@@ -37,7 +37,7 @@ package Bio::EnsEMBL::Hive::AnalysisStats;
use strict;
use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::Utils ('throw');
use Bio::EnsEMBL::Hive::Analysis;
use base ( 'Bio::EnsEMBL::Hive::Storable' );
......
......@@ -43,7 +43,6 @@ package Bio::EnsEMBL::Hive::DBSQL::AnalysisStatsAdaptor;
use strict;
use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::AnalysisStats;
use base ('Bio::EnsEMBL::Hive::DBSQL::ObjectAdaptor');
......
......@@ -36,8 +36,7 @@ package Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use strict;
use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::Utils ('throw');
use Bio::EnsEMBL::Hive::DBSQL::DBConnection;
use Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor;
......@@ -190,7 +189,7 @@ sub get_adaptor {
unless( $self->{'_cached_adaptor'}{$signature} ) {
my $adaptor_package_name = $self->get_available_adaptors()->{$type}
or throw("Could not find a module corresponding to '$type'");
or throw("Could not find a module corresponding to '$type'");
eval "require $adaptor_package_name"
or throw("Could not load or compile module '$adaptor_package_name'");
......
......@@ -53,9 +53,7 @@ package Bio::EnsEMBL::Hive::DataflowRule;
use strict;
use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::Utils ('stringify');
use Bio::EnsEMBL::Hive::Utils ('stringify', 'throw');
use Bio::EnsEMBL::Hive::DBSQL::AnalysisAdaptor;
use base ( 'Bio::EnsEMBL::Hive::Storable' );
......
......@@ -99,12 +99,11 @@ package Bio::EnsEMBL::Hive::Process;
use strict;
use warnings;
use Bio::EnsEMBL::Utils::Exception ('throw');
use Bio::EnsEMBL::Hive::DBSQL::DBConnection;
use Bio::EnsEMBL::Hive::Utils ('stringify', 'go_figure_dbc');
use Bio::EnsEMBL::Hive::Utils::Stopwatch;
use base ('Bio::EnsEMBL::Utils::Exception'); # provide these methods for deriving classes
......@@ -491,6 +490,13 @@ sub dataflow_output_id {
}
sub throw {
my $msg = pop @_;
Bio::EnsEMBL::Hive::Utils::throw( $msg ); # this module doesn't import 'throw' to avoid namespace clash
}
=head2 debug
Title : debug
......
......@@ -212,7 +212,7 @@ sub specialize_new_worker {
if($job_id or $analysis_id or $logic_name) { # probably pre-specialized from command-line
if($job_id) {
print "resetting and fetching job for job_id '$job_id'\n";
warn "resetting and fetching job for job_id '$job_id'\n";
my $job_adaptor = $self->db->get_AnalysisJobAdaptor;
......@@ -677,9 +677,9 @@ sub get_num_failed_analyses {
my $filter_analysis_failed = 0;
foreach my $failed_analysis (@$failed_analyses) {
print "\t##########################################################\n";
print "\t# Too many jobs in analysis '".$failed_analysis->logic_name."' FAILED #\n";
print "\t##########################################################\n\n";
warn "\t##########################################################\n";
warn "\t# Too many jobs in analysis '".$failed_analysis->logic_name."' FAILED #\n";
warn "\t##########################################################\n\n";
if($filter_analysis and ($filter_analysis->dbID == $failed_analysis)) {
$filter_analysis_failed = 1;
}
......
......@@ -52,11 +52,15 @@ package Bio::EnsEMBL::Hive::Utils;
use strict;
use warnings;
use Carp ('confess');
use Data::Dumper;
use Bio::EnsEMBL::Hive::DBSQL::DBConnection;
use Exporter 'import';
our @EXPORT_OK = qw(stringify destringify dir_revhash parse_cmdline_options find_submodules load_file_or_module script_usage url2dbconn_hash go_figure_dbc);
our @EXPORT_OK = qw(stringify destringify dir_revhash parse_cmdline_options find_submodules load_file_or_module script_usage url2dbconn_hash go_figure_dbc throw);
no warnings ('once'); # otherwise the next line complains about $Carp::Internal being used just once
$Carp::Internal{ (__PACKAGE__) }++;
=head2 stringify
......@@ -324,5 +328,14 @@ sub go_figure_dbc {
}
}
sub throw {
my $msg = pop @_;
# TODO: newer versions of Carp are much more tunable, but I am stuck with v1.08 .
# Alternatively, we could implement our own stack reporter instead of Carp::confess.
confess $msg;
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment