error.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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("Not found table")
  14. // ErrUnSupportedType unsupported error
  15. ErrUnSupportedType = errors.New("Unsupported type error")
  16. // ErrNotExist record is not exist error
  17. ErrNotExist = errors.New("Not exist error")
  18. // ErrCacheFailed cache failed error
  19. ErrCacheFailed = errors.New("Cache failed")
  20. // ErrNeedDeletedCond delete needs less one condition error
  21. ErrNeedDeletedCond = errors.New("Delete need at least one condition")
  22. // ErrNotImplemented not implemented
  23. ErrNotImplemented = errors.New("Not implemented")
  24. // ErrConditionType condition type unsupported
  25. ErrConditionType = errors.New("Unsupported conditon type")
  26. // ErrColumnIsNotExist columns is not exist
  27. ErrFieldIsNotExist = errors.New("Field is not exist")
  28. )
  29. // ErrFieldIsNotValid is not valid
  30. type ErrFieldIsNotValid struct {
  31. FieldName string
  32. TableName string
  33. }
  34. func (e ErrFieldIsNotValid) Error() string {
  35. return fmt.Sprintf("field %s is not valid on table %s", e.FieldName, e.TableName)
  36. }