-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ilanolkies
suggested changes
Jan 25, 2022
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>
ilanolkies
approved these changes
Jan 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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