Hemera v1.2.0 Release Notes
-
Summary
๐ hemera 1.2.0 is focused on error handling, plugin dependencies
- โฌ๏ธ Upgrade time: low - none to a couple of hours for most users
- Complexity: low - requires following the list of changes to verifying their impact
- Risk: medium - type checks on error will fail because the hemera error was stripped
- Dependencies: low - existing plugins will work as-is
๐ฅ Breaking Changes
๐ You get the exact error you have sent. Errors are wrapped only for framework errors (Parsing errors, Plugin registration errors, Timeout errors) or logging.
๐ New Features
- ๐ง Enable Server policy to abort requests when the server is not able to respond cause (max memory, busy event-loop). Example Configurable
- ๐ง Long stack traces by default. Configurable
- ๐ง Detect message loops (abort the request and return an error). Example Configurable
- ๐ Enrich errors logs with details (pattern, app-name, timestamp).
- Track network hops in error to identify which clients was involved. Example
Migration Checklist
๐ 1. Pull the wrapped error one level up. For any case except for: HemeraParseError, HemeraError "Error during plugin registration, TimeoutError"
Old:
hemera.add({ topic: 'email', cmd: 'send' }, (resp, cb) => { cb(new Error('Uups')) }) hemera.act({ topic: 'email', cmd: 'send', email: '[email protected]', msg: 'Hi!' }, (err, resp) => { expect(err).to.be.exists() expect(err.name).to.be.equals('BusinessError') expect(err.message).to.be.equals('Business Error') expect(err.cause.name).to.be.equals('Error') expect(err.cause.message).to.be.equals('Uups') hemera.close() done() })
๐ New:
hemera.add({ topic: 'email', cmd: 'send' }, (resp, cb) => { cb(new Error('Uups')) }) hemera.act({ topic: 'email', cmd: 'send', email: '[email protected]', msg: 'Hi!' }, (err, resp) => { expect(err).to.be.exists() expect(err.name).to.be.equals('Error') expect(err.message).to.be.equals('Uups') hemera.close() done() })
๐ 2. All logs are wrapped with the correct Hemera error subclass BusinessError, FatalError ...
๐ 3. Plugin dependencies are declared with peerDependencies instead with
dependencies
property in the plugin.Old:
exports.attributes = { dependencies: ['hemera-joi'] pkg: require('./package.json') }
๐ New:
"peerDependencies": { "hemera-joi": "^1.0.4", "nats-hemera": "1.x || 2.x" }