summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Dumont <dod@debian.org>2021-06-12 18:11:37 +0200
committerDominique Dumont <dod@debian.org>2021-06-12 18:42:58 +0200
commit9bd42cc2e004787c479d667451ed308c3edbad41 (patch)
tree7a9d7b9f5a5bb65b78e302eb5d5d2726f3a438f2
parentbdb4a42af5ae2be86ec738114aa6dc692e13522d (diff)
refactor (Dpkg::Copyright): cleanup eval error handling
-rw-r--r--lib/Config/Model/Dpkg/Copyright.pm18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Config/Model/Dpkg/Copyright.pm b/lib/Config/Model/Dpkg/Copyright.pm
index 991dd0ae..303336a0 100644
--- a/lib/Config/Model/Dpkg/Copyright.pm
+++ b/lib/Config/Model/Dpkg/Copyright.pm
@@ -267,16 +267,18 @@ sub update ($self, %args) {
}
eval {
- $files_obj->fetch_with_id($path_str)->load_data( data => $datum, check =>'yes' );
- };
- if ($@) {
+ $files_obj
+ ->fetch_with_id($path_str)
+ ->load_data( data => $datum, check =>'yes' );
+ 1;
+ } or do {
die "Error: Data extracted from source file is corrupted:\n$@"
."This usually mean that cme or licensecheck (or both) "
."have a bug. You may work-around this issue by adding an override entry in "
."fill.copyright.blanks file. See "
."https://github.com/dod38fr/config-model/wiki/Updating-debian-copyright-file-with-cme "
."for instructions. Last but not least, please file a bug against libconfig-model-dpkg-perl.\n";
- }
+ };
}
# delete global license without text
@@ -332,9 +334,11 @@ sub _apply_fix_scan_copyright_file ($self, $current_dir) {
$self->_say( "Note: loading @fixes fixes from copyright fix files") if @fixes;
foreach my $fix ( @fixes) {
my @l = grep { /[^\s]/ } grep { ! m!^(#|//)! } $fix->lines_utf8;
- eval { $self->load( steps => join(' ',@l) , caller_is_root => 1 ); };
- my $e = $@;
- if ($e) {
+ eval {
+ $self->load( steps => join(' ',@l) , caller_is_root => 1 );
+ 1;
+ } or do {
+ my $e = $@;
my $msg = $e->full_message;
Config::Model::Exception::User->throw(
object => $self,