How to extract LiveBook error message from toast notification?

Hello!

I’ve been trying out LiveBook for some data processing. Sometimes when LiveBook encounters an error, it shows an error message in the cell’s output section. But other times it shows an error in a toast notification in the top-right corner of the screen, like so:

Sorry for the blurred text, I am not allowed to share the actual code this time :frowning:

It looks like this happens when a GenServer.call fails.

Questions:

  1. Is there any way in the UI to copy the error text from the toast notification? If I click on the notification to start dragging & selecting the text, it disappears, which is supper annoying. I’ve been using the Browser’s Developer Tools but this feels like a hack!
  2. Is there any way to make the error show up in the output cell? The GenServer that is erroring was started with Kino.start_child!/1, which I thought would link the process for the cell to the GenServer, but I guess not.

Thank you! If this isn’t enough code I apologize, let me know and I can come up with a smaller example.

1 Like

It’d likely require some small changes to LiveBook. Here’s the .flash component responsible for the toast notification disappearing on click – note the phx-click="lv:clear-flash".

LiveBook has some built-in clipboard functionality that you could potentially tap into for adding a copy button to the flash component.

2 Likes

Hey @jyc, I changed the flash messages to have an explicit close button, so that the content can be freely clicked and selected. See Redesign flash messages by jonatanklosko · Pull Request #2484 · livebook-dev/livebook · GitHub : )

5 Likes

Thank you both!! Really appreciate the help, amazing that you were able to make the change so speedily.

1 Like