Seneca Error Test Utility

0.2.2 · abandoned · verified Sun Apr 19

seneca-error-test is an internal utility package primarily designed for testing error handling mechanisms within the Seneca microservices framework. Released at version 0.2.2, it explicitly states compatibility with Node.js 0.10.31 and Seneca 0.6.0. These are very old versions of both Node.js and Seneca, indicating that the package has not seen active development or maintenance for many years. Consequently, it is highly unlikely to be compatible with modern Node.js versions (v14+) or current stable releases of Seneca (v3+). Its release cadence is effectively zero, as it has remained at 0.2.2 since its initial publication. As an internal test utility, it offers minimal user-facing functionality beyond its specific testing purpose, serving more as a historical artifact or a reference for older Seneca implementations rather than a viable tool for contemporary projects. Its use in new projects is strongly discouraged due to potential compatibility issues and lack of security updates.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing a Seneca instance, loading the seneca-error-test plugin, and invoking a 'fail' command to catch an expected error.

const Seneca = require('seneca')
const senecaErrorTestPlugin = require('seneca-error-test')

async function runErrorTest() {
  const seneca = Seneca({ log: 'silent' })
  // Register the error test plugin
  seneca.use(senecaErrorTestPlugin)

  try {
    // Call a command designed to fail
    const result = await seneca.post('role:error-test,cmd:fail')
    console.log('Unexpected success:', result)
  } catch (err) {
    console.error('Caught expected error:', err.message)
  }

  try {
    // Call a command that returns an error object
    const result = await seneca.post('role:error-test,cmd:errobj,arg:testvalue')
    // In older Seneca, this might not throw but return an object with error properties
    console.log('Result from errobj (may contain error details):', result)
  } catch (err) {
    console.error('Caught error from errobj:', err.message)
  }

  await seneca.close()
}

runErrorTest()

view raw JSON →