error.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. )
  27. // ErrFieldIsNotExist columns does not exist
  28. type ErrFieldIsNotExist struct {
  29. FieldName string
  30. TableName string
  31. }
  32. func (e ErrFieldIsNotExist) Error() string {
  33. return fmt.Sprintf("field %s is not valid on table %s", e.FieldName, e.TableName)
  34. }
  35. // ErrFieldIsNotValid is not valid
  36. type ErrFieldIsNotValid struct {
  37. FieldName string
  38. TableName string
  39. }
  40. func (e ErrFieldIsNotValid) Error() string {
  41. return fmt.Sprintf("field %s is not valid on table %s", e.FieldName, e.TableName)
  42. }