error.go 443 B

12345678910111213141516171819202122
  1. package entities
  2. import "github.com/langgenius/dify-plugin-daemon/internal/utils/parser"
  3. type Error struct {
  4. ErrorType string `json:"error_type"`
  5. Message string `json:"message"`
  6. Args any `json:"args"`
  7. }
  8. func (e *Error) Error() string {
  9. return parser.MarshalJson(e)
  10. }
  11. func NewError(error_type string, message string, args ...any) *Error {
  12. return &Error{
  13. ErrorType: error_type,
  14. Message: message,
  15. Args: args,
  16. }
  17. }