From 78db673a355542aa2090a2bb6687035ce5a77e5c Mon Sep 17 00:00:00 2001
From: Graham McVicker <mcvicker@sanger.ac.uk>
Date: Tue, 13 Jan 2004 12:10:15 +0000
Subject: [PATCH] give more detail when warning

---
 modules/Bio/EnsEMBL/Utils/Exception.pm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Utils/Exception.pm b/modules/Bio/EnsEMBL/Utils/Exception.pm
index 596e012dec..dea57a230d 100644
--- a/modules/Bio/EnsEMBL/Utils/Exception.pm
+++ b/modules/Bio/EnsEMBL/Utils/Exception.pm
@@ -170,11 +170,27 @@ sub warning {
     $i++;
     $file = pop(@path) ."/$file";
   }
+
+  @caller = caller(1);
+  my $caller_line;
+  my $caller_file;
+  $i=0;
+  if(@caller) {
+     @path = split(/\//, $caller[1]);
+     $caller_line = $caller[2];
+     $caller_file = pop(@path);
+     while(@path && $i < 2) {
+       $i++;
+       $caller_file = pop(@path) ."/$caller_file";
+     }
+  }
+
   
   my $out = "\n-------------------- WARNING ----------------------\n".
               "MSG: $string\n".
-              "FILE: $file LINE: $line\n" .
-              "---------------------------------------------------\n";
+              "FILE: $file LINE: $line\n";
+  $out .=     "CALLED BY: $caller_file  LINE: $caller_line\n" if($caller_file);
+  $out .=     "---------------------------------------------------\n";
   print STDERR $out;
 }
 
-- 
GitLab