mirror of
				https://github.com/go-acme/lego.git
				synced 2025-10-31 16:37:41 +02:00 
			
		
		
		
	Add details to the cloudflare error message (#452)
This commit is contained in:
		
				
					committed by
					
						 Ludovic Fernandez
						Ludovic Fernandez
					
				
			
			
				
	
			
			
			
						parent
						
							0593b64674
						
					
				
				
					commit
					517f442fa3
				
			| @@ -7,6 +7,7 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"io" | 	"io" | ||||||
|  | 	"io/ioutil" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"os" | 	"os" | ||||||
| 	"strings" | 	"strings" | ||||||
| @@ -205,7 +206,11 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM | |||||||
| 			} | 			} | ||||||
| 			return nil, fmt.Errorf("Cloudflare API Error \n%s", errStr) | 			return nil, fmt.Errorf("Cloudflare API Error \n%s", errStr) | ||||||
| 		} | 		} | ||||||
| 		return nil, fmt.Errorf("Cloudflare API error") | 		strBody := "Unreadable body" | ||||||
|  | 		if body, err := ioutil.ReadAll(resp.Body); err == nil { | ||||||
|  | 			strBody= string(body) | ||||||
|  | 		} | ||||||
|  | 		return nil, fmt.Errorf("Cloudflare API error. The request %s sent a response with a body which is not in JSON format : %s\n", req.URL.String(), strBody) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return r.Result, nil | 	return r.Result, nil | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user