elixir get error message

To get an error message in Elixir, you can use the IO.inspect/2 function along with the inspect/2 function to display the error message. Here's an example:

try do
  # Code that might raise an error
rescue
  exception -> IO.inspect(exception, label: "Error")
end

In this example, you can replace # Code that might raise an error with the actual code that might produce an error. If an error occurs, it will be caught by the rescue block, and the exception variable will contain the error information. The IO.inspect/2 function is then used to print the error message along with a label "Error".

This will allow you to see the error message and any additional information provided by the exception.