TraitNotImplemented

trait~ TraitNotImplemented

Thrown thrown to indicate a trait is not implemented for a specific type or value.

const { strictEqual: assertIs, throws: assertThrows } = require('assert');
const { Size, size } = require('ferrum');

class Bar {};
assertThrows(() => size(new Bar()));

// The error goes away after implementing the trait
Size.impl(Bar, () => 42);
assertIs(size(new Bar()), 42);

Constructor

new TraitNotImplemented()

Source:
Properties:
Name Type Description
trait Trait

The trait that was not im­ple­men­ted