Example #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
}
Example #2
0
func (easy *Easy) getError(code C.CURLcode) error {
	if CURLcode(code) == E_OK {
		return nil
	}
	err := new(EasyError)
	err.Code = CURLcode(code)
	err.String = C.GoString(C.curl_easy_strerror(code))
	err.EasyString = C.GoString(easy.cerrbuf)
	return err
}
Example #3
0
File: easy.go Project: 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))
}