Skip to content

Route remaining direct throws through throw_if/throw_unless/throw_anyway - #12

Merged
ahamed merged 2 commits into
themeum:mainfrom
ashraful1971:chore/throw
Sep 8, 2026
Merged

Route remaining direct throws through throw_if/throw_unless/throw_anyway#12
ahamed merged 2 commits into
themeum:mainfrom
ashraful1971:chore/throw

Conversation

@ashraful1971

Copy link
Copy Markdown
Contributor

src/ still had 49 call sites across 29 files that threw exceptions directly instead of going through the framework's throw helpers. Convert all of them, dropping the exception class argument where it's already the helper's default (Exception::class), and clean up imports left unused by the change.

Also fixes a latent bug in Connection::run_query_callback() surfaced by the conversion: passing $this->db->last_error as a bare argument (rather than inside empty()) made it eager, which raised an undefined-property warning on wpdb doubles missing that property and broke DatabaseGcTest.

src/ still had 49 call sites across 29 files that threw exceptions
directly instead of going through the framework's throw helpers. Convert
all of them, dropping the exception class argument where it's already
the helper's default (Exception::class), and clean up imports left
unused by the change.

Also fixes a latent bug in Connection::run_query_callback() surfaced by
the conversion: passing $this->db->last_error as a bare argument (rather
than inside empty()) made it eager, which raised an undefined-property
warning on wpdb doubles missing that property and broke DatabaseGcTest.
@ahamed
ahamed merged commit b4be6b2 into themeum:main Sep 8, 2026
1 check passed
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