transaction: Do not make Transaction to implement error interface anymore
As per previous commit, Transaction can't be used anymore as an error value, but we instead we always return the status code.
This commit is contained in:
@@ -126,8 +126,6 @@ func cbPAMConv(s C.int, msg *C.char, c C.uintptr_t) (*C.char, C.int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transaction is the application's handle for a PAM transaction.
|
// Transaction is the application's handle for a PAM transaction.
|
||||||
//
|
|
||||||
//nolint:errname
|
|
||||||
type Transaction struct {
|
type Transaction struct {
|
||||||
handle *C.pam_handle_t
|
handle *C.pam_handle_t
|
||||||
conv *C.struct_pam_conv
|
conv *C.struct_pam_conv
|
||||||
@@ -217,10 +215,6 @@ func start(service, user string, handler ConversationHandler, confDir string) (*
|
|||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transaction) Error() string {
|
|
||||||
return Error(t.lastStatus.Load()).Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Item is a an PAM information type.
|
// Item is a an PAM information type.
|
||||||
type Item int
|
type Item int
|
||||||
|
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ func Test_Error(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
var status Error
|
var status Error
|
||||||
if !errors.As(err, &status) || err.Error() != status.Error() {
|
if !errors.As(err, &status) || err.Error() != status.Error() {
|
||||||
t.Fatalf("error #unexpected status %v vs %v", err.Error(),
|
t.Fatalf("error #unexpected status %#v vs %#v", err.Error(),
|
||||||
status.Error())
|
status.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user