errors.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c)2013-2020 ZeroTier, Inc.
  3. *
  4. * Use of this software is governed by the Business Source License included
  5. * in the LICENSE.TXT file in the project's root directory.
  6. *
  7. * Change Date: 2024-01-01
  8. *
  9. * On the date above, in accordance with the Business Source License, use
  10. * of this software will be governed by version 2.0 of the Apache License.
  11. */
  12. /****/
  13. package zerotier
  14. // Err is a basic string error type for ZeroTier
  15. type Err string
  16. func (e Err) Error() string { return (string)(e) }
  17. // Simple ZeroTier Errors
  18. const (
  19. ErrInternal Err = "internal error"
  20. ErrNodeInitFailed Err = "unable to initialize core Node instance"
  21. ErrInvalidMACAddress Err = "invalid MAC address"
  22. ErrInvalidZeroTierAddress Err = "invalid ZeroTier address"
  23. ErrInvalidNetworkID Err = "invalid network ID"
  24. ErrInvalidParameter Err = "invalid parameter"
  25. ErrTapInitFailed Err = "unable to create native Tap instance"
  26. ErrUnrecognizedIdentityType Err = "unrecognized identity type"
  27. ErrInvalidKey Err = "invalid key data"
  28. )
  29. // APIErr is returned by the JSON API when a call fails
  30. type APIErr struct {
  31. Reason string
  32. }
  33. func (e *APIErr) Error() string { return e.Reason }