since version 4.0 The CerebralError allows you to create your own error types to be used to catch errors in your signals. The catch handler defined on the module will propagate up to parent modules. That means if a nested module does not catch an error, one of the parent modules can catch it if configured to do so.

import { CerebralError } from 'cerebral'

export class MyError extends CerebralError {}

The error is thrown like this:

import { MyError } from './errors'

function someAction () {
  throw new MyError('Some message', {
    // any details

And caught like this:

import { Module } from 'cerebral'
import { MyError } from './errors'
import * as sequences from './sequences'

export default Module({
  signals: {
    somethingHappened: sequences.doThis
  catch: [
    [MyError, sequences.handleError]