@balena/jellyfish-assert
TypeScript icon, indicating that this package has built-in type declarations

1.11.8 • Public • Published

Jellyfish assert

This library contains assert-related utilities for use in Jellyfish.

The Jellyfish system distinguishes between two types of errors:

  • Internal errors, which are unexpected and should be fixed as soon as possible
  • User errors, which are the responsibility of the user and are usually the result of bad user usage of the system

This module provides a handy set of functions to write concise assertions for both types of errors, and remove the amount of error handling if conditionals throughout the code

Usage

Below is an example how to use this library:

import * as assert from '@balena/jellyfish-assert';

assert.INTERNAL(context, version, errors.InvalidVersion, 'Custom error details');
assert.USER(context, input, errors.WorkerNoElement, 'Custom error details');

Readme

Keywords

none

Package Sidebar

Install

npm i @balena/jellyfish-assert

Weekly Downloads

16

Version

1.11.8

License

Apache-2.0

Unpacked Size

19.2 kB

Total Files

9

Last publish

Collaborators

  • dfunckt
  • page
  • balena.io