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

Refactor old code to properly raise Exceptions instead of returning error dictionaries #197

Open
fusion44 opened this issue Apr 21, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@fusion44
Copy link
Owner

fusion44 commented Apr 21, 2023

See:

async def bitcoin_rpc_async(method: str, params: list = []) -> coroutine:

Example:

    except aiohttp.client_exceptions.ClientConnectionError as e:
        return {
            "error": f"Aiohttp client connection error: {str(e)}",
            "status": status.HTTP_503_SERVICE_UNAVAILABLE,
        }

utils.py - redis_get():

async def redis_get(key: str) -> str:

This function returns an empty string when a key is not found in Redis. This is not good. An empty string could be a valid value for a key. The caller can get confused whether the result is an error or just an empty string.

@fusion44 fusion44 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Apr 21, 2023
@fusion44 fusion44 added this to the v0.7.0-beta milestone Apr 21, 2023
@fusion44 fusion44 changed the title Refactor Bitcoin service to use Exceptions instead of returning dictionaries Refactor old code to properly raise Exceptions instead of returning error dictionaries Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant