top | item 37900180

(no title)

oppositelock | 2 years ago

The panics are really annoying. Sometimes, you generate routes dynamically from some data, and it would be nice for this to be an error, so you can handle it yourself and decide to skip a route, or let the user know.

With the panic, I have to write some spaghetti code with a recover in a goroutine.

discuss

order

velcrovan|2 years ago

What kinds of routes would you generate dynamically that couldn't be implemented as wildcards in the match pattern? Genuine question

cowl|2 years ago

> or let the user know

Many are misunderstanding when the panic happens. It does not happen when the user requests the path, it happens when the path is registered. The user will never arrive at that path to be notified. You will be notified that you have a logic error at the application startup. It can be caught by the simplest of tests before you deploy your application.

kunley|2 years ago

Mmmm, code with recover is just a valid code. Calling it spaghetti seems unjustified.