-
v2.1.1 Stable
released this
2026-09-21 16:38:59 +02:00 | 6 commits to main since this releasedaw-lua-common v2.1.1
Highlights
Every error site in
daw-lua-commonnow carries aresource_idthat
points into the newdaw_i18n/v1language resources (i18n/en.json,
canonical, andi18n/de.json). The error contract itself is unchanged
--code,message,dataandcausebehave as in 2.1.0 -- the
resource_idis 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.erroris unreachable, orerror.new()itself fails, every
module returns the reserveddaw-error-facility-unavailablesentinel
(with its ownresource_id), never a plain string and nevernil.New
resource_id/cell_id--error.new()accepts the optional
fieldscell_idandresource_idand returns them on the error
object. Every error construction site in the library sets its own
resource_id.i18n/en.jsonandi18n/de.json-- 240daw_i18n/v1resources
withcontext, parameter declarations and, inde.json, the
source_hashof the canonical English text. A resource is exactly one
error construction site.- Module reference documents in
docs/forbase64,
config_parser,uuid,json,yamland the root module. - New error codes:
tool_detection_failed(crypto.hash, see
below) andattributes_query_failed(fs.exists()/fs.is_dir(),
see below).
Fixed
fs.exists()/fs.is_dir(): everylfs.attributes()failure
was folded intofalse, contradicting their documented "confirmed
absent (false) vs. could not check (nil, err)" contract. Only
ENOENTandENOTDIRnow meanfalse; any other failure (e.g.
EACCES, a symlink cycle) returnsnil, daw_error/v1
(attributes_query_failed).
Closes #57.crypto.hash: a genuinesys:run()failure while detecting
sha256sumwas silently treated as "not installed" and fell through
tosha256 -r. It now returnstool_detection_failedwith the run
error ascause; 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()returnednil, so
callers ended up withnil, nil(inyaml.dumpthis even caused a
raw Lua error). Both a raising and a returning-nothingnew()now
fall through to the sentinel.
Closes #53. decimal.is_decimal():intandscaleare now validated as
integers.crypto.hmac:tmpfile()failures are reported ascause, not
asdata.crypto,decimal,fs: thepcallarounddaw_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,
rootinit);cryptono longer treatsdaw.common.erroras 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
Makefileno longer hasinstall/uninstalltargets; 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 thenorerr.codeis unaffected.
Things to look at if you rely on details:fs.exists()/fs.is_dir()can now returnnil, errfor a path
that exists but cannot be checked (previouslyfalse). Code that
tests the first value for truthiness behaves as before; code that
compares againstfalseor evaluates the second value should handle
attributes_query_failed.- In the bootstrap case (
daw.common.errorunavailable) the return
value is the sentinel object; code that matched a plain string there
needs to checkerr.id == "daw-error-facility-unavailable"instead. resource_idon errors built throughdaw.common.erroris set with
this version ofdaw-lua-common; consumers pinned to 2.1.0 still get
the same errors, but without the field.make installno longer exists; use the git submodule.
Downloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads