Skip to content

fix(cli): classify failures and partial de-panic in the client library - #489

Merged
Harsh4902 merged 3 commits into
microcks:masterfrom
Caesarsage:pr1/classify-errors-and-depanic
Jul 27, 2026
Merged

fix(cli): classify failures and partial de-panic in the client library#489
Harsh4902 merged 3 commits into
microcks:masterfrom
Caesarsage:pr1/classify-errors-and-depanic

Conversation

@Caesarsage

Copy link
Copy Markdown
Contributor

Part of the Microcks CLI v2 work #255.

Introduces a small Failure Kind vocabulary in pkg/errors (Kind, Wrap/Wrapf, KindOf, and an ErrTestFailed sentinel) and makes the client library return classified errors instead of panicking or exiting.

Why

pkg/connectors and keycloak_client previously panic'd on runtime errors (bad response body, unreachable server). A library that can take down its host process is unsafe to embed, which the planned VS Code extension needs to do. Kinds are the library's vocabulary; exit codes stay a CLI concern (added in next PR ()), so pkg/* never depends on them.

Notable

Fixes two real latent bugs found while de-panicking:

  • Keycloak swallowed request-creation errors: nil-pointer dereference.
  • Unchecked openIDResp["access_token"].(string): the CLI crashed on a Keycloak 401 instead of reporting it.

Scope / safety

Additive and non-breaking: the legacy CheckError/Fatal shim and the existing constructor signatures are untouched here (removed/changed in later PRs). Build + tests green.

@Vaishnav88sk

Copy link
Copy Markdown

supersede #481

Comment thread pkg/errors/error_test.go
Comment thread pkg/connectors/microcks_client.go
Comment thread pkg/connectors/keycloak_client.go
Comment thread pkg/connectors/microcks_client.go
@Vaishnav88sk

Copy link
Copy Markdown

DCO is required.

@Caesarsage
Caesarsage force-pushed the pr1/classify-errors-and-depanic branch from c44f139 to f8c27a0 Compare July 23, 2026 08:48
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
@Caesarsage
Caesarsage force-pushed the pr1/classify-errors-and-depanic branch from f8c27a0 to 732b4ae Compare July 23, 2026 08:57
@Caesarsage

Copy link
Copy Markdown
Contributor Author

fixed @Vaishnav88sk

@Vaishnav88sk

Copy link
Copy Markdown

Suggestion:

@Vaishnav88sk

Copy link
Copy Markdown

After that LGTM. 👍🏻

@Caesarsage Caesarsage changed the title fix(cli): classify failures and stop panicking in the client library fix(cli): classify failures and partial de-panic in the client library Jul 23, 2026

@Harsh4902 Harsh4902 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Harsh4902
Harsh4902 merged commit 75009c7 into microcks:master Jul 27, 2026
5 checks 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.

3 participants