gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-util] branch master updated: TalerConfig.


From: gnunet
Subject: [taler-taler-util] branch master updated: TalerConfig.
Date: Mon, 02 Nov 2020 16:35:35 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository taler-util.

The following commit(s) were added to refs/heads/master by this push:
     new 5d2eb1d  TalerConfig.
5d2eb1d is described below

commit 5d2eb1dac4811639eaaff536fc9813424b13ab64
Author: MS <ms@taler.net>
AuthorDate: Mon Nov 2 16:35:06 2020 +0100

    TalerConfig.
    
    Avoid throwing stack traces when a value is
    missing from configuration.
---
 taler/util/talerconfig.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/taler/util/talerconfig.py b/taler/util/talerconfig.py
index 8427f33..699de84 100644
--- a/taler/util/talerconfig.py
+++ b/taler/util/talerconfig.py
@@ -1,4 +1,3 @@
-# This file is part of TALER
 # (C) 2016, 2019 Taler Systems SA
 #
 #  This library is free software; you can redistribute it and/or
@@ -111,7 +110,6 @@ def expand(var: str, getter: Callable[[str], str]) -> str:
 
     return result + var[pos:]
 
-
 ##
 # A configuration entry.
 class Entry:
@@ -170,10 +168,10 @@ class Entry:
     # @return the value, or the given @a default, if not found.
     def value_string(self, default=None, required=False, warn=False) -> str:
         if required and self.value is None:
-            raise ConfigurationError(
-                "Missing required option '%s' in section '%s'"
-                % (self.option.upper(), self.section.upper())
-            )
+            print("Missing required option '%s' in section '%s'"
+                % (self.option.upper(), self.section.upper()))
+            sys.exit(1)
+
         if self.value is None:
             if warn:
                 if default is not None:
@@ -209,10 +207,11 @@ class Entry:
         try:
             return int(value)
         except ValueError:
-            raise ConfigurationError(
+            print(
                 "Expected number for option '%s' in section '%s'"
                 % (self.option.upper(), self.section.upper())
             )
+            sys.exit(1)
 
     ##
     # Fetch value to substitute to expansion variables.

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]