• v2.1.1 3cdcf84ac0

    v2.1.1 Stable

    michael released this 2026-09-21 16:38:59 +02:00 | 6 commits to main since this release

    daw-lua-common v2.1.1

    Highlights

    Every error site in daw-lua-common now carries a resource_id that
    points into the new daw_i18n/v1 language resources (i18n/en.json,
    canonical, and i18n/de.json). The error contract itself is unchanged
    -- code, message, data and cause behave as in 2.1.0 -- the
    resource_id is an additional field so a host can later look up the
    message in its own language.

    The bootstrap case is now uniform across the whole library: if
    daw.common.error is unreachable, or error.new() itself fails, every
    module returns the reserved daw-error-facility-unavailable sentinel
    (with its own resource_id), never a plain string and never nil.

    New

    • resource_id / cell_id -- error.new() accepts the optional
      fields cell_id and resource_id and returns them on the error
      object. Every error construction site in the library sets its own
      resource_id.
    • i18n/en.json and i18n/de.json -- 240 daw_i18n/v1 resources
      with context, parameter declarations and, in de.json, the
      source_hash of the canonical English text. A resource is exactly one
      error construction site.
    • Module reference documents in docs/ for base64,
      config_parser, uuid, json, yaml and the root module.
    • New error codes: tool_detection_failed (crypto.hash, see
      below) and attributes_query_failed (fs.exists()/fs.is_dir(),
      see below).

    Fixed

    • fs.exists() / fs.is_dir(): every lfs.attributes() failure
      was folded into false, contradicting their documented "confirmed
      absent (false) vs. could not check (nil, err)" contract. Only
      ENOENT and ENOTDIR now mean false; any other failure (e.g.
      EACCES, a symlink cycle) returns nil, daw_error/v1
      (attributes_query_failed).
      Closes #57.
    • crypto.hash: a genuine sys:run() failure while detecting
      sha256sum was silently treated as "not installed" and fell through
      to sha256 -r. It now returns tool_detection_failed with the run
      error as cause; an empty result (tool not found) still selects the
      BSD fallback.
      Closes #54.
    • Error helpers, all 26 modules: if daw_error.new() succeeded but
      returned neither an object nor an error, fail() returned nil, so
      callers ended up with nil, nil (in yaml.dump this even caused a
      raw Lua error). Both a raising and a returning-nothing new() now
      fall through to the sentinel.
      Closes #53.
    • decimal.is_decimal(): int and scale are now validated as
      integers.
    • crypto.hmac: tmpfile() failures are reported as cause, not
      as data.
    • crypto, decimal, fs: the pcall around daw_error.new()
      was restored where a refactoring had dropped it.

    Changed

    • The bootstrap fallback is the sentinel object in every module
      (sys, time, uuid, json, yaml, fs, decimal, crypto,
      root init); crypto no longer treats daw.common.error as an
      optional dependency.
    • sys:run() is now explicitly documented (docs/sys.md, code
      comment): the exit status is deliberately not evaluated, run_rc()
      is the variant for it. No behaviour change.
      See #58.
    • The Makefile no longer has install / uninstall targets; the
      library is shipped as a git submodule (lib/daw/common/).
      Closes #59.
    • README: the Contributing section follows the GitHub Issues policy
      (issues and feedback via GitHub Issues are welcome and handled
      there).
      Closes #51.

    Migration notes

    Code that only checks if err then or err.code is unaffected.
    Things to look at if you rely on details:

    • fs.exists() / fs.is_dir() can now return nil, err for a path
      that exists but cannot be checked (previously false). Code that
      tests the first value for truthiness behaves as before; code that
      compares against false or evaluates the second value should handle
      attributes_query_failed.
    • In the bootstrap case (daw.common.error unavailable) the return
      value is the sentinel object; code that matched a plain string there
      needs to check err.id == "daw-error-facility-unavailable" instead.
    • resource_id on errors built through daw.common.error is set with
      this version of daw-lua-common; consumers pinned to 2.1.0 still get
      the same errors, but without the field.
    • make install no longer exists; use the git submodule.
    Downloads