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
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))
}