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

Enhancement/error handling #17

Merged
merged 9 commits into from
Jan 26, 2022

Conversation

agustin-v
Copy link
Contributor

  • Created errorHandler function which replies to the user in case of error.
    Note: the next function is required for all middlewares, otherwise won't fire-up the middleware, so I had to call it after the res.status... because the linter will complain if we don´t use it.

  • Called the next function in all endpoints to delegate the error handling to the middleware

src/middleware/index.ts Show resolved Hide resolved
src/middleware/index.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
agustin-v and others added 4 commits January 26, 2022 09:21
Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>
Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>
Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>
Copy link
Contributor

@ilanolkies ilanolkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@ilanolkies ilanolkies merged commit a4d4ac7 into feature/live-balances Jan 26, 2022
ilanolkies added a commit that referenced this pull request Jan 27, 2022
* Adding CoinMarketCap types

* CoinMarketCap class to access the quotas(prices) of each token or coin

* Added type for query params for the prices endpoint

* Changing return type

* Changing return type

* Adding price endpoint

* Function to convert a new Date object into UTC epoch

* Adding loki js to cache the amount of requests we have performed to the coinmarketcap api

* Implementing lokijs to cache the request count and data from coinmarketcap

* Removing cache system and lokijs

* Adding types for metadata

* Removing error handling from the coinmarketcap lib

* Types for metadata response

* Adding sanitization functions for metadata and quote results

* Running linter

* Endpoint for prices.

* Reunning linter

* socket setup

* something proposal

* better emit event name

* Fixing types syntax

* push new balances working

* minor changes and handle disconnect

* Move parsing logic to coinmarketcap.ts

* Move files

* Refactor api

* Lint

* Refactor json result

* Add tests

* Add error handling tests - move validatoins to api

* review changes

* Getting new transactions from WS explorer api (#11)

* Lint

* Polling function for coinmarketcap prices

* Implemented pushNewPrices socket based on wallet address

* Implementing tokens addresses by chainId, 30 for mainnet and 31 for testnet

* Fixing tests

* Adding chainId parameter for the coinmarketcap class

* Lint

* Fixing merge conflicts

* Removing trailing comma

* Extends map between contract address and coin market cap

* Update list of supported tokens by coinmarketcap

* Filtering out unsupported tokens

* Commenting out the validatePricesRequest function which validates if the token is supported or not, since we are doing that inside the coinmarketcap function

* Commenting out the validatePricesRequest function which validates if the token is supported or not, since we are doing that inside the coinmarketcap function

* coinmarketcap api will fail if no ids passed therefore we added an if if there are no addresses

* adding an empty json as default value for prices, in case the wallet doesnt have any token yet, the backend wont crash because of the coinmarket cap api no receiving tokens ids

* Lint

* Adding only supported tokens

* exporting isConvertSupported function

* Lint

* Adding conditions to handle unsupported convert or addresses

* Modifying tests to handle new responses

* Adding chainId as parameter to the subscriptions

* Adding RBTC as default in the subscriptions

* Add caching strategy to coin market cap

* Fixing test for caching

* Migrate store in cache and filtering missing address

* Fixing name in test and add type for channel response

* Adding tests for caching

* Polling to get contract call transactions (#19)

* Enhancement/error handling (#17)

* Custom error class and errorhandler functio

* Removing errorhandler from here and using it in setupAPI

* Uncommenting the asserts that checked the text of the error message response

* Implementing next function in the error handlers of the promises

* Update src/middleware/index.ts

Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>

* Update src/middleware/index.ts

Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>

* Update src/api/index.ts

Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>

* applying suggestions

Co-authored-by: Agustin Villalobos <agustin.villalobos@iovlabs.org>
Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>

* Push transactions that have higher block number than the last sent

Co-authored-by: Agustin Villalobos V <agustinvillalobos@protonmail.com>
Co-authored-by: Christian Escalante <chescalante@gmail.com>
Co-authored-by: Ilan <ilanolkies@outlook.com>
Co-authored-by: Agustín Villalobos <avillaville@Agustins-MacBook-Pro.local>
Co-authored-by: sleyter93 <96137983+sleyter93@users.noreply.github.com>
Co-authored-by: Agustin Villalobos <agustin.villalobos@iovlabs.org>
Co-authored-by: Sleyter Sandoval <sleyter.sandoval@iovlabs.org>
Co-authored-by: Sleyter Sandoval <sleyter@Sleyters-MacBook-Pro.local>
Co-authored-by: Ilan <36084092+ilanolkies@users.noreply.github.com>
Co-authored-by: Agustín Villalobos <32603375+agustin-v@users.noreply.github.com>
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 this pull request may close these issues.

None yet

2 participants