search for: c_errmsg

Displaying 2 results from an estimated 2 matches for "c_errmsg".

Did you mean: z_errmsg
2020 Feb 19
1
[PATCH] golang: make API idiomatic so that functions return (<val>, error)
.../generator/golang.ml @@ -114,6 +114,11 @@ func (e *GuestfsError) String() string { } } +/* Implement the error interface */ +func (e *GuestfsError) Error() string { + return e.String() +} + func get_error_from_handle (g *Guestfs, op string) *GuestfsError { // NB: DO NOT try to free c_errmsg! c_errmsg := C.guestfs_last_error (g.g) @@ -322,24 +327,24 @@ func return_hashtable (argv **C.char) map[string]string { (* Return type. *) let noreturn = match ret with - | RErr -> pr " *GuestfsError"; "" - | RInt _ -> pr " (i...
2020 Mar 17
0
[PATCH libnbd] Add outline framework for Go language bindings (golang).
....Errmsg); + } else { + return fmt.Sprintf (\"%%s: %%s: %%s\", e.Op, e.Errmsg, e.Errno); + } +} + +/* Implement the error interface */ +func (e *LibnbdError) Error() string { + return e.String() +} + +func get_error (op string) *LibnbdError { + // NB: DO NOT try to free c_errmsg! + c_errmsg := C.nbd_get_error () + errmsg := C.GoString (c_errmsg) + + errno := syscall.Errno (C.nbd_get_errno ()) + + return &LibnbdError{ Op : op, Errmsg : errmsg, Errno : errno } +} + +func closed_handle_error (op string) *LibnbdError { + return &LibnbdError{ Op : op, Err...