livebook-dev / kino

Client-driven interactive widgets for Livebook
Apache License 2.0
372 stars 65 forks source link

Raise if Plug is missing #446

Closed josevalim closed 5 months ago

josevalim commented 5 months ago

@jonatanklosko I wonder how hard it would be for us to add a special exception that automatically injects a button that allows us to click it and the dependency is automatically added. :)

wojtekmach commented 5 months ago

Like Plug.Exception.actions/1?

jonatanklosko commented 5 months ago

FTR we discussed we could add Kino.MissingPackagesError (similar to a few other exceptions we have), but it would be nice to have something more generic, because this kind of exception is more common to be raised by packages with optional dependencies (also, having a dedicated exception just for this one case is a bit of an overkill). We could have a heuristic matching on RuntimeError message, but that's not reliable. Finally, we could have a more specific error in Elixir, but it's weird that the package requirement is really about Mix. For now we are sticking to the regular exception.