私は次のコードに10を加えたとしましょう。Python - ジェネリック関数として例外キャッチを扱う簡単な方法
try:
session.get('http://www.google.com')
except rex.MissingSchema as e:
raise RESTClientException('Bad URL for request: ' + str(url), 'error:url', e)
except rex.ConnectionError as e:
raise RESTClientException('Cannot connect for token', 'error:connection', e)
except rfcex.InsecureTransportError as e:
raise RESTClientException('Verify certificates True without https', 'error:https', e)
これらのすべてを、複数の機能で正確にはどのように使用したいとします。私がこれを行うと考えることができる唯一の方法は次のとおりです。
もっと良い方法がありますか? ありがとう
なぜありません単純に自分自身の機能でtry/wrapをラップする –