• v2.1.0 2c7a7441b8

    v2.1.0 Stable

    michael released this 2026-08-06 22:25:10 +02:00 | 0 commits to main since this release

    daw-lua-common v2.1.0

    Highlights

    daw-lua-common now returns a structured daw_error/v1 object from every
    public function on failure, instead of a plain error string. This is the
    biggest architectural change in this release: every module boundary now
    follows the same error contract, the same "no uncaught Lua errors leave
    a library module" rule, and the same internal-helper-returns-plain-text
    / public-API-builds-one-error-object pattern.

    See README.md and
    daw-contracts: daw_error/v1
    for the full contract.

    New

    • daw.common.error -- new public module, the daw_error/v1
      constructor (error.new(), error.is_error()) used by every other
      module in this library.
    • fs.copy_preserve(src, dst) -- new function shelling out to
      cp -a, preserving symlinks, permissions, timestamps, and ownership.
      fs.copy()/fs.copy_dir() remain content-only (read+rewrite, no
      metadata preservation) and are now explicitly documented as such.
      Closes #40.

    Fixed

    • sys:run_rc(): stderr from the executed command was not actually
      being captured, contrary to the documented contract ("stdout and
      stderr are both captured"). The trailing 2>&1 redirect bound only
      to the marker-printing printf, not to the command itself, due to
      normal shell parsing of cmd; printf ... 2>&1. Fixed by wrapping the
      whole sequence in a POSIX brace group.
    • fs.write_file(): a failed write could go unnoticed. f:write()
      can report success even when the underlying write later fails on
      close() (stdio buffering) -- both are now checked.
    • config_parser: section type (the part before the name in
      [type "name"]) now follows the same [a-z0-9_-] naming convention
      as the section name. Previously [Server "abc"] was silently
      accepted despite the uppercase type.
    • decimal.round()/decimal.div(): decimals/target_scale are
      now validated as non-negative integers, not just "is a number" --
      negative or fractional values previously reached the internal
      power-of-ten helper with undefined behavior.

    Changed

    • decimal.lua and daw.common.error are now directory modules
      (decimal/, error/) split into focused submodules behind a stable
      facade -- require paths are unchanged.
    • Every module's fail()/err() helper now also guards against
      daw.common.error.new() itself raising (not just against require()
      failing), consistent with "no module propagates an uncaught Lua
      error."

    Migration notes

    If any consumer code inspects the err return value directly (e.g.
    err:match(...), string concatenation, pattern matching on error
    text), that code will break -- err is now a table
    ({ schema, id, source, code, message, cause?, data? }), not a string.
    Use err.code for programmatic checks and err.message for the
    human-readable text, or daw.common.error.is_error(err) to check the
    shape.

    This release only touches daw-lua-common itself. Consumer projects
    are migrated to the new contract individually and at their own pace;
    daw-lua-common v1.x behavior for callers not yet updated is
    unaffected until they upgrade their submodule pin.

    Downloads