Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add UdfError::Exist #14691

Merged
merged 4 commits into from
Feb 20, 2024
Merged

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Feb 20, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

refactor: add UdfError::Exist

Refine error handling for UdfMgr.
Avoid using ErrorCode, but instead, use structured error UdfError or
UdfApiError if possible.
Convert to ErrorCode as late as possible.

refactor: rename get_udfs to list_udf
refactor: seperate logic error and service error for UDF API
  • refactor: get_udf() returns None, not ErrorCode.

    So that the caller is able to distinguish a backend meta-service error
    and a NotFound error more easily.

  • refactor: drop_udf(): return None if not dropped. This way to
    distinguish service level error and logic error.

  • Split UdfError into two error: UdfError defines only logic error,
    UdfApiError defines errors occurred in the service level or
    dependent components, such as Tenant. These two errors do not
    overlap.

Changelog

  • Improvement

Related Issues


This change is Reviewable

@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Feb 20, 2024
@drmingdrmer drmingdrmer marked this pull request as ready for review February 20, 2024 05:38
- refactor: get_udf() returns None, not ErrorCode.

  So that the caller is able to distinguish a backend meta-service error
  and a `NotFound` error more easily.

- refactor: drop_udf(): return None if not dropped. This way to
  distinguish service level error and logic error.

- Split UdfError into two error: `UdfError` defines only logic error,
  `UdfApiError` defines errors occurred in the service level or
  dependent components, such as `Tenant`. These two errors do not
  overlap.
Refine error handling for `UdfMgr`.
Avoid using `ErrorCode`, but instead, use structured error `UdfError` or
`UdfApiError` if possible.
Convert to `ErrorCode` as late as possible.
By using `NonEmptyStr` and `NonEmptyString` to store a tenant,
`UserApiProvider` guarantees the tenant str is valid.

Other changes:

- An error should not contain any **tenant** info in its `to_string()`
  result.
Copy link
Collaborator

@TCeason TCeason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drmingdrmer drmingdrmer merged commit 96a1d90 into datafuselabs:main Feb 20, 2024
71 of 72 checks passed
@drmingdrmer drmingdrmer deleted the 53-xx branch February 20, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-refactor this PR changes the code base without new features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants