Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Exceptions. #92

Open
appetrosyan opened this issue Nov 16, 2021 · 2 comments
Open

Better Exceptions. #92

appetrosyan opened this issue Nov 16, 2021 · 2 comments
Assignees
Labels
enhancement iroha2 Pull requests and issues associated with iroha 2

Comments

@appetrosyan
Copy link
Contributor

Because iroha-python is a wrapper around rust code, the full trace-back for an exception is truncated to the Python code in which it was called. So all exceptions should contain the maximum amount of information.

For example

Traceback (most recent call last):
   File "/mnt/Archive/Git/iroha-python/example/./test.py", line 18, in <module>
hash = cl.submit_isi(register)
   File "/home/app/.local/lib/python3.9/site-packages/iroha2/__init__.py", line 39, in submit_isi
return self.submit_tx([_Instruction(isi)])
   File "/home/app/.local/lib/python3.9/site-packages/iroha2/__init__.py", line 36, in submit_tx
return self.cl.submit_all_with_metadata(tx, {})
   Exception: Failed to send transaction with hash HashOf(7f95850f295eb71cc94c40923a93f1e26d34dd401f216698a5fc4d2292344d26, PhantomData)

is insufficiently informative.

@appetrosyan appetrosyan added enhancement iroha2 Pull requests and issues associated with iroha 2 labels Jan 27, 2022
@QuentinI QuentinI self-assigned this Jul 4, 2022
@6r1d
Copy link
Contributor

6r1d commented Mar 3, 2023

I'm moving the information from #137 here, as it is a duplicate.

Today, sgull reported an error while trying to run the most basic documentation example while using a default config from the docs.

import json
from iroha2 import Client

cfg = json.loads(open("config.json").read())
cl = Client(cfg)

This is the error log, which, honestly, doesn't tell a lot to respond about:

Exception                                 Traceback (most recent call last)
Cell In[55], line 6
      4 cfg = json.loads(open("config.json").read())
      5 # cfg
----> 6 cl = Client(cfg)

File ~/.local/lib/python3.10/site-packages/iroha2/__init__.py:13, in Client.__init__(self, cfg, headers)
     11 def __init__(self, cfg, headers=None):
     12     if headers is None:
---> 13         self.cl = _Client(cfg)
     14     else:
     15         self.cl = _Client.with_headers(cfg, headers)

This error also repeats when he tries to run a test.py file.

@h4rit
Copy link

h4rit commented Mar 3, 2023

update: running the code with a modified config ( removing "ACCOUNT_ID": "alice@wonderland", ) seems to go through without any errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement iroha2 Pull requests and issues associated with iroha 2
Projects
None yet
Development

No branches or pull requests

4 participants