示例#1
0
func NewError(code C.CURLcode) (err *CurlError) {
	if CURLcode(code) == E_OK {
		return nil
	}
	err = new(CurlError)
	err.Code = CURLcode(code)
	err.String = C.GoString(C.curl_easy_strerror(C.CURLcode(err.Code)))
	return err
}
示例#2
0
文件: easy.go 项目: ym/go-curl
func (e CurlError) Error() string {
	// ret is const char*, no need to free
	ret := C.curl_easy_strerror(C.CURLcode(e))
	return fmt.Sprintf("curl: %s", C.GoString(ret))
}