Skip to content

ErrorCode

ErrorCode = "ERR_COMPRS_INVALID_ARG" | "ERR_COMPRS_UNKNOWN_FORMAT" | "ERR_COMPRS_CORRUPT_DATA" | "ERR_COMPRS_TRUNCATED" | "ERR_COMPRS_SIZE_LIMIT" | "ERR_COMPRS_STREAM_FINISHED" | "ERR_COMPRS_STREAM_CLOSED" | "ERR_COMPRS_OPERATION_FAILED"

Defined in: next/api.d.ts:69

The code that every error of the functions carries:

  • ERR_COMPRS_INVALID_ARG: an argument or an option is invalid: of the wrong type, out of range, or not for the format. The error is a TypeError;
  • ERR_COMPRS_UNKNOWN_FORMAT: decompression without a format could not detect the format of the data, empty data included;
  • ERR_COMPRS_CORRUPT_DATA: the data is not valid in its format, or has data after the end of the compressed stream;
  • ERR_COMPRS_TRUNCATED: the data ends before the end of the compressed stream, as empty data in a given format does;
  • ERR_COMPRS_SIZE_LIMIT: the output would exceed maxOutputSize, or, under a maxOutputSize of 64 MiB or less, a zstd frame declares a window larger than the limit allows, as DecompressOptions.maxOutputSize describes;
  • ERR_COMPRS_STREAM_FINISHED and ERR_COMPRS_STREAM_CLOSED: a stream was used after it finished or was closed. The functions of this module do not give them;
  • ERR_COMPRS_OPERATION_FAILED: any other failure, such as a failed allocation, or dictionary training that found too little to learn from.

Every error but ERR_COMPRS_INVALID_ARG is a plain Error. New codes may be added in minor releases. An error thrown by the caller’s own code, such as a getter of an options object or the iterator of the samples, is passed on unchanged, without a code, and so is the reason of an aborted AbortOptions.signal. In the browser build, a panic, or an allocation that the WebAssembly memory cannot grow for, fails with a WebAssembly.RuntimeError instead, without a code.