Manually triggering function error for debugging purposes

Is there a way to manually throw an error in order to get access to debugging logs? I’m testing functions on a dev store with preview enabled, but the functions do not seem to be working after deploy and I can’t figure out how to trigger an error report as described in the docs. I attempted to just immediately return an error with a custom error message from the main function but that doesn’t seem to have done anything either. Any help here?

1 Like

Hi @tontinedev

Your best option in Rust for manually triggering an error is to use panic!. Then you can take an action which triggers your function (such as adding a product to cart or changing the quantity in the cart), which will then trigger an error report as described in the docs. The error report will show your function input and any other debug output you’ve printed to STDERR.

We are working on simpler ways of exposing debugging information to you, but this is your best approach in the mean time.

-Nick