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

Re: [RFC PATCH 1/1] Add a type for errors

From
Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Date
Oct 1, 2024, 15:29 UTC
Message-ID
<ZvwVZs-HLy0RiP3E@ugly>
In-Reply-To
<20240930220352.2461975-2-sandals@crustytoothpaste.net>
On Mon, Sep 30, 2024 at 10:03:52PM +0000, brian m. carlson wrote:
Show 7 quoted lines
>+		case GIT_ERR_MULTIPLE:
>+			strbuf_addf(buf, _("multiple errors:\n"));
>+			for (size_t i = 0; i < me->count; i++) {
>+				git_error_strbuf(buf, me->errs[i]);
>+				strbuf_addstr(buf, "\n");
>+			}
>+		}

ah. i was wondering how you'd address this ("this" being non-fatal errors piling up), as i'm facing the same problem in a project of mine.

the problem is that one can either impose a very rigid formatting (as you do here), or provide formatting options, which can get arbitrarily complex. so i wonder whether one shouldn't pursue a hybrid approach instead: singular return values for low-level functions that either work or fail fatally, and error callbacks for higher-level functionality?

btw, the switch misses breaks.
Previous: Patrick SteinhardtNext: Phillip Wood
Message 6 of 21 in “Typed errors”
  1. 0/1 Typed errorsbrian m. carlson, Sep 30, 2024
  2. 1/1 Add a type for errorsbrian m. carlson, Sep 30, 2024
  3. Junio C HamanoSep 30, 2024
  4. brian m. carlsonSep 30, 2024
  5. Patrick SteinhardtOct 21, 2024
  6. Oswald BuddenhagenOct 1, 2024
  7. Phillip WoodOct 2, 2024
  8. Emily ShafferOct 1, 2024
  9. brian m. carlsonOct 2, 2024
  10. Phillip WoodOct 2, 2024
  11. brian m. carlsonOct 2, 2024
  12. Eric SunshineOct 2, 2024
  13. brian m. carlsonOct 2, 2024
  14. Eric SunshineOct 3, 2024
  15. Junio C HamanoOct 3, 2024
  16. Eric SunshineOct 3, 2024
  17. brian m. carlsonOct 4, 2024
  18. phillip.wood123@gmail.comOct 4, 2024
  19. Richard KerryOct 4, 2024
  20. Emily ShafferOct 3, 2024
  21. phillip.wood123@gmail.comOct 4, 2024

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.