Explorar el Código

fix readme.md

wenzuochao hace 6 años
padre
commit
09232227da
Se han modificado 2 ficheros con 12 adiciones y 1 borrados
  1. 7 1
      README.md
  2. 5 0
      README_zh.md

+ 7 - 1
README.md

@@ -1,6 +1,6 @@
 # Alibaba Cloud Go Software Development Kit
 
-[![Codacy Badge](https://api.codacy.com/project/badge/Grade/291a39e242364b04ad442f0cce0e30d5)](https://app.codacy.com/app/aliyun/alibaba-cloud-sdk-go?utm_source=github.com&utm_medium=referral&utm_content=aliyun/alibaba-cloud-sdk-go&utm_campaign=Badge_Grade_Dashboard)
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/291a39e242364b04ad442f0cce0e30d5)](https://app.codacy.com/app/aliyun/alibaba-cloud-sdk-go?utm_source=github.com&utm_medium=referral&utm_content=aliyun/alibaba-cloud-sdk-go&utm_campaign=Badge_Grade_Dashboard)
 [![Travis Build Status](https://travis-ci.org/aliyun/alibaba-cloud-sdk-go.svg?branch=master)](https://travis-ci.org/aliyun/alibaba-cloud-sdk-go)
 [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/hmhx3lawe4v2ii5c?svg=true)](https://ci.appveyor.com/project/wenzuochao/alibaba-cloud-sdk-go)
 [![Go Report Card](https://goreportcard.com/badge/github.com/aliyun/alibaba-cloud-sdk-go)](https://goreportcard.com/report/github.com/aliyun/alibaba-cloud-sdk-go)
@@ -93,6 +93,10 @@ func main() {
 
 When you create an instance of client, you need to fill out three parameters: `Region ID`、`Access Key ID` and `Access Key Secret`. You can get `Access Key ID` and `Access Key Secret` from console, and get `Region ID` from [region list](https://help.aliyun.com/document_detail/40654.html?spm=5176.doc52740.2.8.FogWrd)
 
+## Dubug
+
+If the request has occured an error, you can view the HTTP request process by adding the environment variable `DEBUG=sdk`.
+
 ## Keepalive
 Alibaba Cloud Go SDK uses primordial `net/http` of Go language to send and accept requests,so it's  configuration is the same as `net/http`'s,you can use config to deliver configuration to the bottomed httpClient.
 
@@ -191,6 +195,7 @@ func main() {
 
 	client, err := sdk.NewClientWithAccessKey("cn-hangzhou", os.Getenv("ACCESS_KEY_ID"), os.Getenv("ACCESS_KEY_SECRET"))
 	if err != nil {
+		// Handle exceptions
 		panic(err)
 	}
 
@@ -204,6 +209,7 @@ func main() {
 
 	response, err := client.ProcessCommonRequest(request)
 	if err != nil {
+		// Handle exceptions
 		panic(err)
 	}
 

+ 5 - 0
README_zh.md

@@ -83,6 +83,9 @@ func main() {
 
 在创建Client实例时,您需要填写3个参数:`Region ID`、`Access Key ID`和`Access Key Secret`。`Access Key ID`和`Access Key Secret`可以从控制台获得;而`Region ID`可以从[地域列表](https://help.aliyun.com/document_detail/40654.html?spm=5176.doc52740.2.8.FogWrd)中获得
 
+## Debug
+
+如果您发送的请求出错,您可以通过添加环境变量 `DEBUG=sdk` 来查看 HTTP 请求过程。
 
 ## Keepalive
 阿里云 Go SDK 底层使用 Go 语言原生的 `net/http` 收发请求,因此配置方式与 `net/http`相同,您可以通过 config 直接将配置传递给底层的 httpClient
@@ -182,6 +185,7 @@ func main() {
 
 	client, err := sdk.NewClientWithAccessKey("cn-hangzhou", os.Getenv("ACCESS_KEY_ID"), os.Getenv("ACCESS_KEY_SECRET"))
 	if err != nil {
+		// 异常处理
 		panic(err)
 	}
 
@@ -195,6 +199,7 @@ func main() {
 
 	response, err := client.ProcessCommonRequest(request)
 	if err != nil {
+		// 异常处理
 		panic(err)
 	}