Beispiel #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
}
Beispiel #2
0
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))
}