Why do you think you need this? I could be wrong but I think try/rescue is expensive, and it’s generally avoided in Elixir code. Why not just let the Ecto error raise itself? Or maybe better, you could validate the input and raise a custom exception before hitting the database.
Whatever you return from rescue will be the return from the try do block, and as @al2o3cr said, IO.inspect returns its argument. In your rescue block you can do anything you want with the rescued exception, but if you don’t want execution to continue to the next function call you’ll need to reraise.






















