error.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2015 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xorm
  5. import (
  6. "errors"
  7. "fmt"
  8. )
  9. var (
  10. // ErrParamsType params error
  11. ErrParamsType = errors.New("Params type error")
  12. // ErrTableNotFound table not found error
  13. ErrTableNotFound = errors.New("Table not found")
  14. // ErrUnSupportedType unsupported error
  15. ErrUnSupportedType = errors.New("Unsupported type error")
  16. // ErrNotExist record does not exist error
  17. ErrNotExist = errors.New("Record does not exist")
  18. // ErrCacheFailed cache failed error
  19. ErrCacheFailed = errors.New("Cache failed")
  20. // ErrNeedDeletedCond delete needs less one condition error
  21. ErrNeedDeletedCond = errors.New("Delete action needs at least one condition")
  22. // ErrNotImplemented not implemented
  23. ErrNotImplemented = errors.New("Not implemented")
  24. // ErrConditionType condition type unsupported
  25. ErrConditionType = errors.New("Unsupported condition type")
  26. // ErrUnSupportedSQLType parameter of SQL is not supported
  27. ErrUnSupportedSQLType = errors.New("unsupported sql type")
  28. )
  29. // ErrFieldIsNotExist columns does not exist
  30. type ErrFieldIsNotExist struct {
  31. FieldName string
  32. TableName string
  33. }
  34. func (e ErrFieldIsNotExist) Error() string {
  35. return fmt.Sprintf("field %s is not valid on table %s", e.FieldName, e.TableName)
  36. }
  37. // ErrFieldIsNotValid is not valid
  38. type ErrFieldIsNotValid struct {
  39. FieldName string
  40. TableName string
  41. }
  42. func (e ErrFieldIsNotValid) Error() string {
  43. return fmt.Sprintf("field %s is not valid on table %s", e.FieldName, e.TableName)
  44. }