Skip to content

Function: isCommandNotFoundError() ​

Check whether an error is a CommandNotFoundError.

instanceof alone is not enough: @gunshi/plugin is bundled with its own copy of this class (noExternal: ['gunshi/plugin']), so an error thrown by gunshi is never an instance of the class a plugin imports. Errors from another copy are recognized through the Symbol.for('gunshi.CommandNotFoundError') brand, which does not depend on error.name.

Signature ​

ts
export function isCommandNotFoundError(error: unknown): error is CommandNotFoundError

Parameters ​

NameTypeDescription
errorunknownAn unknown error

Returns ​

error is CommandNotFoundError — true if the error is a CommandNotFoundError

Released under the MIT License.