Skip to content

Commit

Permalink
Remove C_KZG_OK from makeErrorFromRet
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia committed Feb 22, 2024
1 parent c7d6ae9 commit 8ed9355
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bindings/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,18 @@ var (
///////////////////////////////////////////////////////////////////////////////

// makeErrorFromRet translates an (integral) return value, as reported
// by the C library, into a proper Go error. If there is no error, this
// will return nil.
// by the C library, into a proper Go error. This function should only be
// called when there is an error, not with C_KZG_OK.
func makeErrorFromRet(ret C.C_KZG_RET) error {
switch ret {
case C.C_KZG_OK:
return nil
case C.C_KZG_BADARGS:
return ErrBadArgs
case C.C_KZG_ERROR:
return ErrError
case C.C_KZG_MALLOC:
return ErrMalloc
}
return fmt.Errorf("unexpected return value from c-library %v", ret)
return fmt.Errorf("unexpected error from c-library: %v", ret)
}

///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 8ed9355

Please sign in to comment.