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
F56961737: D4152.id10883.diff
Wed, Nov 11, 20:23
F56949975: D4152.id10884.diff
Wed, Nov 11, 12:32
F56940835: D4152.id.diff
Wed, Nov 11, 06:26
F56924293: D4152.diff
Tue, Nov 10, 22:55
F56631672: D4152.diff
Sat, Nov 7, 20:31
F56048009: D4152.id.diff
Mon, Nov 2, 08:27
F55902811: D4152.id10884.diff
Sun, Nov 1, 10:07
Unknown Object (File)
Sat, Oct 31, 00:23
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 Not Applicable
Unit
Tests Not Applicable