error.go 486 B

123456789101112131415161718192021
  1. // error.go - Functions for converting libalpm erros to Go errors.
  2. //
  3. // Copyright (c) 2013 The go-alpm Authors
  4. //
  5. // MIT Licensed. See LICENSE for details.
  6. package alpm
  7. // #include <alpm.h>
  8. import "C"
  9. // The Error type represents error codes from libalpm.
  10. type Error C.alpm_errno_t
  11. var _ error = Error(0)
  12. // The string representation of an error is given by C function
  13. // alpm_strerror().
  14. func (er Error) Error() string {
  15. return C.GoString(C.alpm_strerror(C.alpm_errno_t(er)))
  16. }