Whether a caught value is one of this library's coded errors.
The caught value.
True when it carries a LibcantusErrorCode.
import { isLibcantusError, voiceChord, parseChordSymbol } from '@libraz/libcantus';try { voiceChord(parseChordSymbol('C'), { ranges: [] });} catch (error) { if (isLibcantusError(error) && error.code === 'NO_SOLUTION') { // loosen the constraints rather than blaming the input }} Copy
import { isLibcantusError, voiceChord, parseChordSymbol } from '@libraz/libcantus';try { voiceChord(parseChordSymbol('C'), { ranges: [] });} catch (error) { if (isLibcantusError(error) && error.code === 'NO_SOLUTION') { // loosen the constraints rather than blaming the input }}
Whether a caught value is one of this library's coded errors.