Fix section "How to handle errors" in 12.2.md
This commit is contained in:
10
en/12.2.md
10
en/12.2.md
@@ -28,11 +28,11 @@ Before implementing error handling, we must be clear about what goals we are try
|
|||||||
|
|
||||||
## How to handle errors
|
## How to handle errors
|
||||||
|
|
||||||
Error Handling In fact, we have eleven chapters in the first section which has been how to design error handling, here we have another example from a detailed explanation about how to handle different errors:
|
In chapter 11, we addressed the process of error handling and design using some examples. Let's go into these examples in a bit more detail, and see some other error handling scenarios:
|
||||||
|
|
||||||
- Notify the user errors:
|
- Notify the user of errors:
|
||||||
|
|
||||||
Notify the user when accessing the page we can have two kinds of errors: 404.html and error.html, the following were the source of the error page displays:
|
When an error occurs, we can present the user accessing the page with two kinds of errors pages: 404.html and error.html. Here is an example of what the source code of an error page might look like:
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ Notify the user when accessing the page we can have two kinds of errors: 404.htm
|
|||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
Another source:
|
Another example:
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ Another source:
|
|||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
Error handling logic 404, an error if the system operation is similar, and we see that:
|
404 error-handling logic, in the occurrence of a system error:
|
||||||
|
|
||||||
func (p *MyMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (p *MyMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.URL.Path == "/" {
|
if r.URL.Path == "/" {
|
||||||
|
|||||||
Reference in New Issue
Block a user