sapphireplugin-subcommands can't catch error?

Hello! I am using this subcommands plugin and i cannot log error in the console. no idea what is going on
Solution:
Not sure what you mean. Need more info. But it should be noted that subcommands have their own error listeners as documented here: https://www.sapphirejs.dev/docs/Documentation/api-plugins/modules/subcommands_src#subcommandpluginevents
Sapphire Framework
Module: subcommands/src | Sapphire
Namespaces
Jump to solution
3 Replies
Solution
Favna
Favna2y ago
Not sure what you mean. Need more info. But it should be noted that subcommands have their own error listeners as documented here: https://www.sapphirejs.dev/docs/Documentation/api-plugins/modules/subcommands_src#subcommandpluginevents
Sapphire Framework
Module: subcommands/src | Sapphire
Namespaces
qxb3
qxb32y ago
Any invalid code doesnt throw any error when i use it Example Code:
const { Subcommand } = require('@sapphire/plugins-subcommand')

class PingCommand extends Subcommand {
constructor(context, options) {
super(context, {
...options,
subcommands: [
{ name: 'add', messageRun: 'add' }
]
})
}

add() {
nonExistingFunc()
jdkdkd
dkdkkd
}
}

module.exports = PingCommand
const { Subcommand } = require('@sapphire/plugins-subcommand')

class PingCommand extends Subcommand {
constructor(context, options) {
super(context, {
...options,
subcommands: [
{ name: 'add', messageRun: 'add' }
]
})
}

add() {
nonExistingFunc()
jdkdkd
dkdkkd
}
}

module.exports = PingCommand
^ this code doesnt throw any error
Favna
Favna2y ago
Then don't write invalid code? Anyway yes it doesn't throw It emits an event on the listener as mentioned https://github.com/sapphiredev/plugins/blob/a61871d4336a80049ff00c6b98526e512c6813de/packages/subcommands/src/lib/Subcommand.ts#L280