3 ms·
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 yo
by oppositelock 3y 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.
- velcrovan 3y agoWhat kinds of routes would you generate dynamically that couldn't be implemented as wildcards in the match pattern? Genuine question
- cowl 3y 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 3y agoMmmm, code with recover is just a valid code. Calling it spaghetti seems unjustified.