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

Add error handling for every external call #45

Closed
trizin opened this issue Aug 16, 2023 · 4 comments · Fixed by #132
Closed

Add error handling for every external call #45

trizin opened this issue Aug 16, 2023 · 4 comments · Fixed by #132

Comments

@trizin
Copy link
Contributor

trizin commented Aug 16, 2023

Handle unexpected errors such as:
web3.exceptions.BlockNotFound

So agents do not exit on random errors and keep running.

DoD:

  • for every external call, there's an error-handling mechanism in place
@trentmc
Copy link
Member

trentmc commented Aug 17, 2023

It will be useful to enumerate the specific behaviors to catch. So that this issue has a clearer definition of done (DoD). cc @trizin

@trizin
Copy link
Contributor Author

trizin commented Aug 26, 2023

Essentially, we need to integrate an error-handling mechanism wherever we make external calls. Depending on the nature of the error encountered:

  • If the subgraph is down: Quit the app.
  • For temporary query errors: Retry query up to x times.
  • etc.

@trentmc
Copy link
Member

trentmc commented Aug 28, 2023

OK! This is better. And I guess the DoD is:

  • this is complete when: for every external call, there's an error-handling mechanism in place

@trentmc trentmc changed the title Add Error Handling Add error handling for every external call Aug 28, 2023
@trizin
Copy link
Contributor Author

trizin commented Sep 4, 2023

Another common error:

  File "/app/pdr_backend/dfbuyer/main.py", line 133, in <module>

    main()

  File "/app/pdr_backend/dfbuyer/main.py", line 127, in main

    log_loop(block)

  File "/app/pdr_backend/dfbuyer/main.py", line 114, in log_loop

    block = web3_config.w3.eth.get_block(blockno, full_transactions=False)

  File "/usr/local/lib/python3.8/site-packages/web3/eth/eth.py", line 390, in get_block

    return self._get_block(block_identifier, full_transactions)

  File "/usr/local/lib/python3.8/site-packages/web3/module.py", line 73, in caller

    result = w3.manager.request_blocking(

  File "/usr/local/lib/python3.8/site-packages/web3/manager.py", line 250, in request_blocking

    return self.formatted_response(

  File "/usr/local/lib/python3.8/site-packages/web3/manager.py", line 223, in formatted_response

    apply_null_result_formatters(null_result_formatters, response, params)

  File "/usr/local/lib/python3.8/site-packages/web3/manager.py", line 97, in apply_null_result_formatters

    formatted_resp = pipe(params, null_result_formatters)

  File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe

  File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe

  File "/usr/local/lib/python3.8/site-packages/web3/_utils/method_formatters.py", line 794, in raise_block_not_found

    raise BlockNotFound(message)

web3.exceptions.BlockNotFound: Block with id: '0x257b39' not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants