Skip to content

feat: add is_* error predicates for all DbError categories (#91)#103

Merged
lxsaah merged 2 commits into
aimdb-dev:mainfrom
ggmaldo:fix/add-is-error-predicates
May 11, 2026
Merged

feat: add is_* error predicates for all DbError categories (#91)#103
lxsaah merged 2 commits into
aimdb-dev:mainfrom
ggmaldo:fix/add-is-error-predicates

Conversation

@ggmaldo
Copy link
Copy Markdown
Contributor

@ggmaldo ggmaldo commented May 10, 2026

Description

Added the missing is_* predicate methods to DbError to match the existing pattern of is_network_error, is_capacity_error and is_hardware_error.

New predicates:

  • is_buffer_error
  • is_database_error
  • is_configuration_error
  • is_runtime_error
  • is_transform_error
  • is_io_error (std only)
  • is_json_error (std only)

Each predicate has a corresponding unit test.

How to test

cargo test -p aimdb-core

Related Issue

@ggmaldo ggmaldo requested a review from lxsaah as a code owner May 10, 2026 20:55
@ggmaldo
Copy link
Copy Markdown
Contributor Author

ggmaldo commented May 11, 2026

@lxsaah I'm currently waiting for your approval.

Copy link
Copy Markdown
Contributor

@lxsaah lxsaah left a comment

Choose a reason for hiding this comment

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

Thanks for jumping on this @ggmaldo, the code itself is in good shape: all 7 predicates added with the right matches! pattern, std-only ones correctly gated behind #[cfg(feature = "std")] and a test per predicate. Nice catch on the trailing-whitespace fix in the existing doc comments too.

Two things to address before this can be merged:

1. Line endings (the big one). The file got committed with CRLF line endings instead of LF, which is why GitHub is showing this as +924/-810 — git sees every line as changed. When I diff with --ignore-cr-at-eol, the real change is only +116/-2. Could you fix the line endings and force-push? Something like:

git config --global core.autocrlf false
# from your branch:
dos2unix aimdb-core/src/error.rs   # or re-save the file as LF in your editor
git add aimdb-core/src/error.rs
git commit --amend --no-edit
git push --force-with-lease

2. Doc comments on the new predicates. The existing is_network_error / is_capacity_error / is_hardware_error each have a one-line /// doc comment. The new predicates are missing them, please add one per predicate to keep the style consistent (see inline comment).

Once those two are addressed I'll re-review. Appreciate the contribution!

Comment thread aimdb-core/src/error.rs Outdated
matches!(self, DbError::HardwareError { .. })
}

pub fn is_buffer_error(&self) -> bool {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you add a one-line /// doc comment on each of the new predicates (is_buffer_error, is_database_error, is_configuration_error, is_runtime_error, is_transform_error, is_io_error, is_json_error) to match the style of the existing is_network_error / is_capacity_error / is_hardware_error above? Something like /// Returns true if this is a buffer-related error is enough.

@ggmaldo
Copy link
Copy Markdown
Contributor Author

ggmaldo commented May 11, 2026

Perfect @lxsaah , I did:

git config --global core.autocrlf false
dos2unix aimdb-core/src/error.rs

and commented "///" for every is_*_error

for commiting:

git add aimdb-core/src/error.rs
git commit -m "feat: add is_* error predicates for all DbError categories (#91)"
git push origin fix/add-is-error-predicates

Copy link
Copy Markdown
Contributor

@lxsaah lxsaah left a comment

Choose a reason for hiding this comment

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

Thanks, the diff looks clean now!

@lxsaah lxsaah merged commit f1bc718 into aimdb-dev:main May 11, 2026
5 checks passed
@ggmaldo ggmaldo deleted the fix/add-is-error-predicates branch May 11, 2026 21:43
@ggmaldo
Copy link
Copy Markdown
Contributor Author

ggmaldo commented May 11, 2026

@lxsaah, Do you need anything else?

@lxsaah
Copy link
Copy Markdown
Contributor

lxsaah commented May 12, 2026

Thanks so much for your help @ggmaldo , really appreciated! Feel free to pick another issue that interests you and I'll assign it to you.

Hopefully this weekend I'll have some more time for triage. I'm planning to split the larger issues into smaller, more focused ones, so there will be even more to pick from soon.

On my end, I'm currently working on some content to make the framework more popular and get more visibility for it. You can check out the blog here: https://aimdb.dev/blog

One thing that would really help: if you could ask your fellow devs to star the repo, that would bring some great traction to the project! Every star counts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants