Exemplo n.º 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
}
Exemplo n.º 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
}
Exemplo n.º 3
0
Arquivo: easy.go Projeto: 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))
}