-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patherror.go
More file actions
23 lines (20 loc) · 734 Bytes
/
error.go
File metadata and controls
23 lines (20 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package lolhtml
/*
#include "lol_html.h"
*/
import "C"
import "errors"
// ErrCannotGetErrorMessage indicates getting error code from lol_html, but unable to acquire the concrete
// error message.
var ErrCannotGetErrorMessage = errors.New("cannot get error message from underlying lol_html lib")
// getError is a helper function that gets error message for the last function call.
// You should make sure there is an error when calling this, or the function interprets
// the NULL error message obtained as ErrCannotGetErrorMessage.
func getError() error {
errC := (*str)(C.lol_html_take_last_error())
defer errC.Free()
if errMsg := errC.String(); errMsg != "" {
return errors.New(errMsg)
}
return ErrCannotGetErrorMessage
}