diff --git a/src/warden-client/lib/WardenClientCommon.pm b/src/warden-client/lib/WardenClientCommon.pm
index 03775b6df7c6213ce693420192b186e90f2008d7..d0e87bdf13ed090248e9dc87a1230c0aa10b4cda 100755
--- a/src/warden-client/lib/WardenClientCommon.pm
+++ b/src/warden-client/lib/WardenClientCommon.pm
@@ -19,6 +19,18 @@ use Carp;
 our $VERSION = "2.2";
 
 
+#-------------------------------------------------------------------------------
+# trim - remove whitespace from the start and end of the string
+#-------------------------------------------------------------------------------
+sub trim
+{
+  my $string = shift;
+  $string =~ s/^\s+//;
+  $string =~ s/\s+$//;
+  return $string;
+} # End of trim
+
+
 #-------------------------------------------------------------------------------
 # errMsg - prints error msg and returns undef or prints warning and returns 1
 #-------------------------------------------------------------------------------
@@ -68,11 +80,11 @@ sub c2s
   # create SOAP::Transport::HTTP:Client object
   eval {
     $client = SOAP::Transport::HTTP::Client->new();
-  } or return errMsg("Error in function 'c2s()' when creating SOAP::Transport::HTTP::Client object: " . $@);
+  } or return errMsg("Error in function 'c2s()' when creating SOAP::Transport::HTTP::Client object: " . trim($@));
 
   # setting of connection timeout
   eval {$client->timeout($WardenClientCommon::CONNECTION_TIMEOUT);}
-  or return errMsg("Error in function 'c2s()' when setting connection timeout: " . $@);
+  or return errMsg("Error in function 'c2s()' when setting connection timeout: " . trim($@));
 
   # setting of SSL options
   eval {
@@ -83,24 +95,24 @@ sub c2s
                     SSL_cert_file       => $WardenClientCommon::SSL_CERT,
                     SSL_ca_file         => $WardenClientCommon::SSL_CA_CERT);
     return 1; # fix of eval triggering 'or' statement
-  } or return errMsg("Ërror in function 'c2s()' when setting SSL options: " . $@);
+  } or return errMsg("Ërror in function 'c2s()' when setting SSL options: " . trim($@));
 
   # setting of service URI
   my $soap;
   eval {
     $soap = SOAP::Lite->uri($service)->proxy($WardenClientCommon::URI);
-  } or return errMsg("Error in function 'c2s()' when setting service URI: " . $@);
+  } or return errMsg("Error in function 'c2s()' when setting service URI: " . trim($@));
 
   # serialize SOAP envelope or SOAP envelope and data object
   my $envelope;
   if (!defined $data) {
     eval {
       $envelope = $soap->serializer->envelope(method => $method);
-    } or return errMsg("Error in function 'c2s()' when serializing envelope: " . $@);
+    } or return errMsg("Error in function 'c2s()' when serializing envelope: " . trim($@));
   } else {
     eval {
       $envelope = $soap->serializer->envelope(method => $method, $data);
-    } or return errMsg("Error in function 'c2s()' when serializing envelope and data: " . $@);
+    } or return errMsg("Error in function 'c2s()' when serializing envelope and data: " . trim($@));
   }
 
   # setting of complete HTTPs URI and send serialized SOAP envelope and data
@@ -108,7 +120,7 @@ sub c2s
   my $result;
   eval {
     $result = $client->send_receive(envelope => $envelope, endpoint => $server_uri);
-  } or return errMsg("Error in function 'c2s()' when sending SOAP envelope and data: " . $@);
+  } or return errMsg("Error in function 'c2s()' when sending SOAP envelope and data: " . trim($@));
 
   # check server response
   if (!defined $result) {
@@ -118,9 +130,9 @@ sub c2s
     my $response;
     eval {
       $response = $soap->deserializer->deserialize($result);
-    } or return errMsg("Error in deserialization of server response:" . $@ . "\nReceived response: " . $result);
+    } or return errMsg("Error in deserialization of server response: " . trim($@) . "\nReceived response: " . trim($result));
     # check SOAP fault status
-    $response->fault ? return errMsg("Server sent error message: " . $response->faultstring) : return $response;
+    $response->fault ? return errMsg("Server sent error message: " . trim($response->faultstring)) : return $response;
   }
 }
 
@@ -144,8 +156,8 @@ sub loadConf
   our $SYSLOG_FACILITY      = undef;
 
   unless (do $conf_file) {
-    die("Errors in config file '$conf_file': $@") if $@;
-    die("Can't read config file '$conf_file': $!") unless defined $_;
+    die("Errors in config file '$conf_file': " . trim($@)) if $@;
+    die("Can't read config file '$conf_file': " . trim($!)) unless defined $_;
     # if $_ defined, it's retvalue of last statement of conf, for which we don't care
   }
 } # End of loadConf