-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams-errors.go
More file actions
41 lines (34 loc) · 888 Bytes
/
params-errors.go
File metadata and controls
41 lines (34 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package goliburing
/*
#include <string.h>
#include <errno.h>
*/
import "C"
import "fmt"
// ErrCreateParamsCode Error codes returned from NewParams
type ErrCreateParamsCode = int
const (
// ErrCreateParamsEMALLOC Could not allocate memory for params.
ErrCreateParamsEMALLOC ErrCreateParamsCode = 0
)
// ErrCreateParams Represents an error while creating io_uring_params.
type ErrCreateParams struct {
Code ErrCreateParamsCode
Message string
}
// NewErrCreateParams Creates a new create params error.
func NewErrCreateParams(code C.int) *ErrCreateParams {
var message string
if code == 1 {
message = "could not allocate memory"
} else {
message = "unknown error occurred."
}
return &ErrCreateParams{
Code: ErrCreateParamsCode(code),
Message: message,
}
}
func (e *ErrCreateParams) Error() string {
return fmt.Sprintf("create params failed: %s", e.Message)
}