Skip to content

[chore] Hot Fix Examples Async/Await Execution #11

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lizard-boy
Copy link

What changed? Why?

  • Our examples define async functions. Currently, they are not awaited which can result in the execution of the script completed before the promise resolves
  • The examples are updated to properly handle the example function calls

Qualified Impact

@dakshgup
Copy link

@greptileai

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request updates the example files in the src/examples directory to properly handle asynchronous function calls and improve error handling.

  • Wrapped main function calls in immediately invoked async functions (IIFEs) with try-catch blocks in all example files
  • Removed unnecessary await keyword from wallet.getDefaultAddress() in create_wallet.js
  • Ensured proper awaiting of async functions to prevent premature script termination
  • Improved error logging for better debugging and user feedback in all examples

4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

try {
await fundWallet();
} catch (error) {
console.error("Error during funding wallet", error);
Copy link

Choose a reason for hiding this comment

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

style: Consider adding more detailed error logging, such as including the error stack trace

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.

3 participants