Error groups #289

Open
opened 2026-01-29 20:41:27 +00:00 by claunia · 0 comments
Owner

Originally created by @andrew-aladev on GitHub (Sep 12, 2019).

Hello. I see brotli provides a wide list of errors:

#define BROTLI_DECODER_ERROR_CODES_LIST...
/* Errors caused by invalid input */
...
/* Memory allocation problems */
...

Today all these error codes have only one group: BROTLI_DECODER_RESULT_ERROR.

static BROTLI_NOINLINE BrotliDecoderResult SaveErrorCode(
  BrotliDecoderState* s, BrotliDecoderErrorCode e) {
  ...
  switch (e) {
    ...
    default:
      return BROTLI_DECODER_RESULT_ERROR;
  } 
}

So if user want to know when decoder received corrupted source he have to list all 16 codes. It makes too tight and unreliable connection between brotli implementation and application.

Can you please provide several error groups like: BROTLI_DECODER_RESULT_CORRUPTED_SOURCE, BROTLI_DECODER_RESULT_ALLOCATION_FAILED and etc? Thank you.

Originally created by @andrew-aladev on GitHub (Sep 12, 2019). Hello. I see brotli provides a wide list of errors: ``` #define BROTLI_DECODER_ERROR_CODES_LIST... /* Errors caused by invalid input */ ... /* Memory allocation problems */ ... ``` Today all these error codes have only one group: `BROTLI_DECODER_RESULT_ERROR`. ``` static BROTLI_NOINLINE BrotliDecoderResult SaveErrorCode( BrotliDecoderState* s, BrotliDecoderErrorCode e) { ... switch (e) { ... default: return BROTLI_DECODER_RESULT_ERROR; } } ``` So if user want to know when decoder received corrupted source he have to list all **16 codes**. It makes too tight and unreliable connection between brotli implementation and application. Can you please provide several error groups like: `BROTLI_DECODER_RESULT_CORRUPTED_SOURCE`, `BROTLI_DECODER_RESULT_ALLOCATION_FAILED` and etc? Thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#289