N
nick
I have a problem with catching my own exception. Here is the code:
http://fly.srk.fer.hr/~nick/travapi/blame.php?repname=Travian+API&path=/village.py&
Line 252 calls a method, which on line 207 raises a
SomethingBeingBuiltError exception. On line 253 I catch that
exception, but when I run that code, I get:
Traceback (most recent call last):
File "village.py", line 252, in <module>
v.upgrade_cheapest()
File "/media/data/home/code/travapi/village.py", line 207, in upgrade_cheapest
raise SomethingBeingBuiltError()
village.SomethingBeingBuiltError: 'Unable to upgrade, check if something is being built.'
If I change line 253 to only "except:", everything works as
expected. How come? What am I missing? Any help would be appreciated.
P.S.: I'm aware I'm exposing my login/pass in the code. Don't care
really, those are throwaway accounts.
http://fly.srk.fer.hr/~nick/travapi/blame.php?repname=Travian+API&path=/village.py&
Line 252 calls a method, which on line 207 raises a
SomethingBeingBuiltError exception. On line 253 I catch that
exception, but when I run that code, I get:
Traceback (most recent call last):
File "village.py", line 252, in <module>
v.upgrade_cheapest()
File "/media/data/home/code/travapi/village.py", line 207, in upgrade_cheapest
raise SomethingBeingBuiltError()
village.SomethingBeingBuiltError: 'Unable to upgrade, check if something is being built.'
If I change line 253 to only "except:", everything works as
expected. How come? What am I missing? Any help would be appreciated.
P.S.: I'm aware I'm exposing my login/pass in the code. Don't care
really, those are throwaway accounts.