Page MenuHomeDevCentral

Allow to easily throw error response in ApiJsonResponse<T> methdods
ClosedPublic

Authored by dereckson on Aug 9 2026, 22:41.
Tags
None
Referenced Files
F53709139: D4152.diff
Sun, Oct 11, 17:25
Unknown Object (File)
Sat, Oct 10, 13:23
Unknown Object (File)
Sat, Oct 10, 00:00
Unknown Object (File)
Thu, Oct 8, 19:17
Unknown Object (File)
Tue, Oct 6, 15:19
Unknown Object (File)
Tue, Oct 6, 01:20
Unknown Object (File)
Mon, Oct 5, 00:47
Unknown Object (File)
Sun, Oct 4, 22:57
Subscribers
None

Details

Summary

While StatusCode can already be parsed as a response,
it's not always easy to propagate the correct Ok() signature
in a method that only returns errors.

Throw the error variant is trivial, but verbose so an helper method
error_response(status_code, error_message) can be helpful to keep
code easy to read and maintain.

Expected use:

if ... {
    return error_response(StatusCode::..., "...");
}
Test Plan

Tested with Alkane HTTP API server code.

Diff Detail

Repository
rLF Limiting Factor
Lint
Lint Passed
Unit
No Test Coverage
Branch
main
Build Status
Buildable 6786
Build 7074: arc lint + arc unit