git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Typed errors
@ 2024-09-30 22:03 brian m. carlson
  2024-09-30 22:03 ` [RFC PATCH 1/1] Add a type for errors brian m. carlson
  0 siblings, 1 reply; 21+ messages in thread
From: brian m. carlson @ 2024-09-30 22:03 UTC (permalink / raw)
  To: git; +Cc: Emily Shaffer

We've discussed, as part of the libification effors and at the most
recent Git Merge conference, the possibility of typed errors in Git.
This would be useful because it allows users of our library to
understand why an error occurred and what to do about it in addition to
knowing just that one occurred.

In addition, as someone who has done a lot of scripting of Git in my
professional life, I've noticed we have a plethora of different messages
for the same problem.  As a consequence, it's very difficult to
automatically map all errors where an object is absent into a distinct
error type, which makes automation hard.  It would be easier to work
with Git as a scripting aid if all error of the same type produced a
uniform message that could be easily parsed.

I had indicated that I have a design for this, which I've improved with
feedback from the contributor summit.  This is, therefore, an RFC that
doesn't wire things up in any way, but is suitable for discussion about
the approach and design. It may be that we eventually adopt this
approach, or we may discard it in favour of another, and either way,
that's fine.

I will say that the fact that we have a pointer here is useful, but it
means that freeing memory is necessary.  That's inconvenient, but if we
choose to adopt Rust on a larger scale, it should be much easier to
handle by simply using a `Drop` implementation to free the memory.

brian m. carlson (1):
  Add a type for errors

 Makefile |   1 +
 error.c  |  43 ++++++++++++++
 error.h  | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 212 insertions(+)
 create mode 100644 error.c
 create mode 100644 error.h


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-10-21 12:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 22:03 [RFC PATCH 0/1] Typed errors brian m. carlson
2024-09-30 22:03 ` [RFC PATCH 1/1] Add a type for errors brian m. carlson
2024-09-30 22:44   ` Junio C Hamano
2024-09-30 23:35     ` brian m. carlson
2024-10-21 12:46       ` Patrick Steinhardt
2024-10-01 15:29   ` Oswald Buddenhagen
2024-10-02 14:01     ` Phillip Wood
2024-10-01 20:31   ` Emily Shaffer
2024-10-02 21:51     ` brian m. carlson
2024-10-02  9:54   ` Phillip Wood
2024-10-02 22:04     ` brian m. carlson
2024-10-02 22:16       ` Eric Sunshine
2024-10-02 22:24         ` brian m. carlson
2024-10-03  5:14           ` Eric Sunshine
2024-10-03 16:05             ` Junio C Hamano
2024-10-03 22:27               ` Eric Sunshine
2024-10-04  0:15                 ` brian m. carlson
2024-10-04  9:00       ` phillip.wood123
2024-10-04 12:13         ` Richard Kerry
2024-10-03 16:17     ` Emily Shaffer
2024-10-04  9:00       ` phillip.wood123

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).