git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 0/2] gitweb: die_error (error handling) improvements

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 13, 2010, 07:55 UTC
Message-ID
<201012130855.23013.jnareb@gmail.com>
In-Reply-To
<4D058228.7040905@eaglescrag.net>
On Mon, 13 Dec 2010, J.H. wrote:
> On 12/12/2010 04:46 PM, Jakub Narebski wrote:
Show 10 quoted lines
> > The following two patch series changes improve error / exception
> > handling in gitweb, preparing the way for gitweb output caching, but
> > useful even without it.
> > 
> > I'm sending this patch series early to gather feedback on possible
> > ways of improving error / exception handling in gitweb.
> 
> Personally, instead of another band-aid over this problem, and adding
> (or further legitimizing) goto statements inside gitweb I'd much *MUCH*
> rather we actually put in the work to actually clean this up.
That's not band-aid, that's using Perl exception mechanism.  Gitweb
uses die_error() like one would ordinarily use "die".
 
> This is the direction I'm heading in, which I mentioned in an earlier
> e-mail.

Well, then how do you want to handle errors? Note that die_error calls are sometimes nested quite deep in the call stack, so using return value to denote errors and checking it is rather out of question: it would significantly increase complexity of code for no gain.

Nevertheless I'll take a look how it is solved in other web applications
written in Perl, like SVN::Web or CPAN Hubble.
 
Show 5 quoted lines
> There are a *LOT* of disadvantages to the eval mechanism in perl.  It's
> the standard but gitweb is getting more and more complex, and eval is
> simplistic.  Couple that with the complexity and uncertainty that things
> like goto add to the code, I would *MUCH* rather not see this series go
> in, as I think it is the wrong approach to fixing this.

eval / die is not like goto, but like exception mechanism in other languages. I'd prefer to use Try::Tiny or TryCatch, but we have this "no extra dependencies" policy for gitweb.

-- 
Jakub Narebski
Poland
Previous: J.H.Next: Jakub Narebski
Message 5 of 6 in “gitweb: die_error (error handling) improvements”
  1. 0/2 gitweb: die_error (error handling) improvementsJakub Narebski, Dec 13, 2010
  2. 1/2 gitweb: Go to DONE_REQUEST rather than DONE_GITWEB in die_errorJakub Narebski, Dec 13, 2010
  3. 2/2 gitweb: use eval + die for error (exception) handlingJakub Narebski, Dec 13, 2010
  4. J.H.Dec 13, 2010
  5. Jakub NarebskiDec 13, 2010
  6. Jakub NarebskiDec 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.