[PATCH] osmo-gsm-tester[master]: resource: Allow passing keyword args to NoResourceExn

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Sep 14 17:03:24 UTC 2017


Review at  https://gerrit.osmocom.org/3954

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
---
M src/osmo_gsm_tester/resource.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/54/3954/1

diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index a7abc99..37c5a7e 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -209,7 +209,8 @@
 
 
 class NoResourceExn(Exception):
-    pass
+    def __init__(self, *messages, **named_items):
+        super().__init__(log.compose_message(messages, named_items))
 
 class Resources(dict):
 

-- 
To view, visit https://gerrit.osmocom.org/3954
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic960ae8db5372b0a4640356f0b4820ed42477b46
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list