tom_basics 2.0.1
tom_basics: ^2.0.1 copied to clipboard
Basic utilities for the TOM framework including exception handling with UUID tracking.
2.0.1 #
-
Every exception key this package shows follows the framework convention. The keys were
UPPER_SNAKE—USER_NOT_FOUND,VALIDATION_ERROR,BOOM— whiletom_core_kernel, which derivesTomExceptionfrom the class declared here, uses dotted lowercase<area>.<operation>.<condition>and listsUSER_NOT_FOUNDexplicitly as a form to avoid. So the base class taught one convention and the derived class taught the opposite, and a reader met whichever came first.Documentation only: this package raises no exception of its own, so all 18 literals were dartdoc examples, README samples, tests or sample apps. Nothing a consumer switches on has changed.
TomBaseException.key's own dartdoc now states the shape — the field is declared here, so the contract for its values belongs here — and namestom_core_kernelas where the convention is set out in full rather than restating the reasoning. The README says the same where it introduces the key.
2.0.0 #
-
Breaking:
TomBaseException.stackisStackTrace?, notObject?. The field promised a width the very next line refused: the constructor hands it straight to_getStackTrace, which openeds as StackTrace?— an unchecked downcast throwingTypeErrorfor any non-null value that was not a trace. So a value the field's type invited could only ever fail, and fail while reporting some other failure, which is the one path where a thrown error costs the most: the report dies and the original error goes unrecorded._getStackTrace's parameter narrows with it and the cast is gone. Rejecting a wrong argument at compile time costs a caller nothing; the cast cost them the failure they were trying to report.Major rather than minor, though nothing in the Tom framework can observe the difference. Every exception in
tom_core_kernelandtom_core_serverreaches this class by forwardingsuper.stackfrom a constructor that already declaredStackTrace?, so the wide field was unreachable through any of them and the cast never fired. The break is real only for code that constructsTomBaseExceptiondirectly with a non-trace, assigns one to.stackafter construction, or overrides the field — and a caller pinned to^1.0.3is not moved onto this release, which is what the major bump is for.
1.0.3 #
- Fixed
TomRuntime.setCurrentEnvironmentto apply its fallback unconditionally (RCL1). The fallback branches were guarded by_currentEnvironment == null, so once a current environment was set, calling the setter with an unregistered name silently kept the old environment instead of switching to the fallback — a setter that refuses to set. The fallback (defaultRoot, a named environment, or the root) now applies whether or not a current environment is already active, and the named-fallback branch returns instead of falling through to the root. No back-compat shim.
1.0.2 #
- Added
TomRuntime.reset()to clear the process-global environment/platform registries (RCL1). The environment and platform registries are static process-global state. A real application registers each environment once at startup, but independent units of work that each build their own runtime — most visibly tests and runnable samples executed in one process — would otherwise inherit registrations from a previously executed unit. A secondaddEnvironment('dev', ...)then leaves twodeventries andsetCurrentEnvironment('dev')resolves the earlier one, running the wrong initializer.reset()clears the environment and platform lists, drops the active environment/platform selections, and restores the root environment todefaultTomEnvironment. It mirrorsTomBean.resetBeanContextfor the bean registry; call it between independent units to isolate them.
1.0.1 #
- Fixed
TomLoggerpush/pop log-level stack to proper LIFO semantics (RCE6).popLogLevel()previously removed the front of the level stack (removeAt(0)) rather than the most recently pushed level, so it could not restore the pre-push level; and the current level was tracked in a separate_logLevelfield that could diverge from the stack. The stack top is now the single source of truth:logLevelis a getter returning_levelStack.last,setLogLevelreplaces the top in place,pushLogLevelappends, andpopLogLevelusesremoveLast()(guarded so the base level is never popped).setLogLevelByName('info'); pushLogLevel(trace); popLogLevel()now correctly restoresinfo, and nested push/pop unwinds in LIFO order. No back-compat shim — the buggy front-removal behaviour is gone.
1.0.0 #
- Initial version.