summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-09-14 17:35:03 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-09-14 17:41:46 +0200
commite5faa3bf2046efcfc7412299887f802c15a413b8 (patch)
treeaec035a091de66ff0c229b0ec7d20b9824414cf9
parent98dcdd3a2957934d8c8193bb9257f201a38a230b (diff)
resource: Allow passing keyword args to NoResourceExn
Same code is already being used by log.Error exception. This way we can use: raise resource.NoResourceExn("No free arfcns in any of bands", bands=supported_bands) And get: osmo_gsm_tester.resource.NoResourceExn: No free arfcns in any of bands {bands=['GSM-850', 'GSM-900', 'GSM-1800', 'GSM-1900']} Change-Id: Ic960ae8db5372b0a4640356f0b4820ed42477b46
-rw-r--r--src/osmo_gsm_tester/resource.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 68cf615..80328d4 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -218,7 +218,8 @@ class ResourcesPool(log.Origin):
class NoResourceExn(Exception):
- pass
+ def __init__(self, *messages, **named_items):
+ super().__init__(log.compose_message(messages, named_items))
class Resources(dict):