rhh4x0R
rhh4x0R
Explore posts from servers
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
It catches the UserError though, too.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Doh, I have to use UserError instead of Error.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
@favna Do you know how to pull out the identifier in the errorr handling actually?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Nevermind, must've been a build error.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Then on the listener, it picks up the identifier but not messeage.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
throw new UserError({ identifier: "permissions", message: 'You must have the role Sensei to use this command.'}) })
throw new UserError({ identifier: "permissions", message: 'You must have the role Sensei to use this command.'}) })
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Right now, the UserError doesn't pick up the message. Any ideas?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
I'll paste my code here for anyone looking for it once I get it.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
I’ll play around. It’d be cool to get preconditions built in for the sub commands. Maybe I’ll make a wrapper or something.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
So I have to if statement on every subcommand.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
I see, gotcha.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Apologies for the verboseness - im used to Rust docs and this is my first TS project so im learning how to navigate the docs.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
(Basically just trying to figure out how to implement that exactly) — I pass the interaction into the new function which is a sub command chat input — so that will automatically be detected by UserError?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
How does it know that it’s from a sub command error though if it’s in a separate function outside of the ai command itself?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Ohhh — that UserError will end up in the sub command error. Got it.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Instead of using throw new UserError for instance.
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
For instance the chatinputsubcommanderror, and that’ll hook to the listener?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Ah ok so if I implement the sub command error listener, then I can just call one of those sub command errors manually from that new function?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
Yeah makes sense. I can run a check manually in my sub commands no problem - I just want to account for the error correctly and return a response, as without that it has all sorts of defer issues.
40 replies