Unrecoverable errors while running locally do not return any specific error in terminal
Discord thread ref: https://discord.com/channels/803236282088161321/1077698025155215360
If a web service panics while running locally, it will simply return this:
Error: Custom error:
With proper error handling generally this should not happen, but in cases where it does due to user error (for example: could not unwrap a value critical to the webservice running because it couldn't be found and therefore it panics), the local run will simply panic and then return the above. This can be solved by attempting to deploy, then checking the deploy logs and seeing exactly where the web service panicked on, but generally this isn't ideal for reasons related to having to potentially deploy before a service is ready for production (amongst others).
I'm not really sure how to fix this issue since local logging appears to be streamed through a channel - some guidance would be appreciated here. Some minor documentation changes will be made to make sure it's explicitly clear that the Secrets.toml file should be at the Cargo.toml level and hopefully prevent confusion.
Yes, we should definitely improve this. I am curious though, because I believe if you do have a Secrets.toml file but the key is missing, you will get the expected error that you set with .context(...) in the main file. If that is the case, I believe this error (Error: Custom error:) without a message is the result of having the shuttle_secrets attribute on the main function, without a discoverable/existing Secrets.toml file. Perhaps there is an easy win in there somewhere, and we can just add a message? Since we are actually getting an error.
I took a quick look now and it may be more complicated than I thought, because if a Secrets.toml is missing the local run should just use an empty BTreeMap, and then the project should error when trying to retrieve the key... I'll think about it and comment here if I think of something :smile: