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

Translation needed for existing languages #255

Open
github-actions bot opened this issue Oct 13, 2024 · 0 comments
Open

Translation needed for existing languages #255

github-actions bot opened this issue Oct 13, 2024 · 0 comments

Comments

@github-actions
Copy link

@sumn2u has made changes on the original english version of the book (PR #254)

Visual Diff of Changes:

diff --git a/en/SUMMARY.md b/en/SUMMARY.md
index 87df426..ab6b8ab 100644
--- a/en/SUMMARY.md
+++ b/en/SUMMARY.md
@@ -73,6 +73,7 @@
 - [Error Handling](error-handling/README.md)
   - [Try...Catch](error-handling/try...-catch.md)
   - [Try...Catch...Finally](error-handling/try...catch...finally.md)
+  - [Asynchronous Error Handling](error-handling/async_errorhandling.md)
 - [Modules](modules.md)
 - [Regular Expression](regular-expression.md)
 - [Classes](classes/README.md)
diff --git a/en/error-handling/README.md b/en/error-handling/README.md
index e79981e..ad8122e 100644
--- a/en/error-handling/README.md
+++ b/en/error-handling/README.md
@@ -58,8 +58,10 @@ One of the common error handling techniques is the `try...catch` block, which is
 * [try...catch](./try...-catch.md)
 * [try...catch...finally](./try...catch...finally.md)
 
-Error handling is a critical aspect of JavaScript development.
-By understanding the types of errors, and following best practices, 
-you can write more reliable and user-friendly applications.
+## Asynchronous Error Handling
+
+Handling errors in asynchronous code can be tricky. In synchronous code, errors are caught immediately, but with asynchronous operations like API calls, errors may occur later. You'll handle them in callbacks or promises, so you need to be prepared. We'll cover how to manage these errors using promises and `async/await` in the section below.
+
+* [Asynchronous Error Handling](./async_errorhandling.md)
 
 
diff --git a/en/error-handling/async_errorhandling.md b/en/error-handling/async_errorhandling.md
index 9f4a245..0423aa9 100644
--- a/en/error-handling/async_errorhandling.md
+++ b/en/error-handling/async_errorhandling.md
@@ -1,4 +1,7 @@
-
+---
+chapter: 12
+pageNumber: 87
+description: Handling asynchronous errors is a bit more complex than synchronous errors. The issue is that the code that generates the error is not directly responsible for handling the error. Instead, the error will be handled by the callback function that is executed when the asynchronous operation is complete.
 ---
 
 # Asynchronous Error Handling
@@ -10,7 +13,7 @@ The example below shows how you can handle asynchronous errors:
 
 A common example is when using the `fetch` API to download some data from a server. The `fetch` API returns a promise that resolves with the server response. If the server returns an error, the promise will reject with the error.
 
-### Example 1: Using `try...catch` with `async/await`
+#### Using `try...catch` with `async/await`
 
 Using `async/await` makes asynchronous code look and behave more like synchronous code, which can make it easier to read and understand. Here's how you can handle errors using `try...catch`:
 
@@ -30,7 +33,7 @@ async function fetchData(url) {

-### Example 2: Handling errors with .catch() in Promises
+#### Handling errors with .catch() in Promises
When using Promises directly, you can handle errors using the .catch() method:

@@ -91,7 +94,7 @@ async function fetchData(url) {

-### Graceful Degradation: Provide fallback behavior or user-friendly error messages.
+#### Graceful Degradation: Provide fallback behavior or user-friendly error messages.

async function fetchData(url) {
@@ -110,7 +113,7 @@ async function fetchData(url) {

-### Logging: Log errors for debugging and monitoring purposes.
+#### Logging: Log errors for debugging and monitoring purposes.

async function fetchData(url) {
@@ -134,7 +137,7 @@ function logErrorToService(error) {

-### Avoid Silent Failures: Ensure that errors are not swallowed silently; always log or handle them.
+#### Avoid Silent Failures: Ensure that errors are not swallowed silently; always log or handle them.

@@ -154,7 +157,7 @@ async function fetchData(url) {



-### Centralized Error Handling: Consider using a centralized error handling mechanism for larger applications.
+#### Centralized Error Handling: Consider using a centralized error handling mechanism for larger applications.


```javascript
@@ -177,8 +180,6 @@ function handleError(error) {
}

-## Conclusion

Proper error handling in asynchronous operations is crucial for building resilient JavaScript applications. By following the examples and best practices outlined in this guide, you can ensure that your code gracefully handles errors, provides meaningful feedback to users, and maintains overall application stability. Always remember to handle errors in every asynchronous operation, use try...catch with async/await for readability, and implement centralized error handling for larger applications. With these strategies, you can effectively manage asynchronous errors and create more reliable and user-friendly applications.

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

No branches or pull requests

0 participants