@athas/shared-utils
external-readySmall shared utility package for error extraction and async action result helpers.
Purpose
@athas/shared-utils hosts tiny cross-app utilities that are generic enough to avoid app-level duplication.
Current modules
errorsgetErrorMessage(error, fallback)getFirstErrorMessage(errors, fallback)
async-actionsrunAsyncAction(action, fallback)successActionResult()failureActionResult(error, fallback)
Usage example
import { runAsyncAction } from '@athas/shared-utils'
const result = await runAsyncAction(async () => {
await saveSettings()
}, 'Unable to save settings')
if (!result.ok) {
console.error(result.error)
}Evolution rule
Only add utilities that are:
- domain-agnostic
- used in multiple packages/apps
- easy to test and maintain
Where it fits in the core strategy
@athas/shared-utils should remain the smallest package in the workspace and avoid becoming a dumping ground.
Use this package for:
- tiny domain-agnostic helpers
- stable primitives reused by many packages
Do not place here:
- auth, billing, telemetry, notifications, or integrations domain logic
- framework adapters (NestJS/Hono/React-specific runtime wiring)
If a utility starts to model business meaning, graduate it into its domain core package.