dominikbraun / graph

A library for creating generic graph data structures and modifying, analyzing, and visualizing them.
https://graph.dominikbraun.io
Apache License 2.0
1.77k stars 95 forks source link

Add error structs to give more information on errors #156

Open gordon-klotho opened 9 months ago

gordon-klotho commented 9 months ago

Adds the following error structs:

This may be breaking if users check err == instead of errors.Is for specific errors (such as err == ErrVertexNotFound and not errors.Is(err, ErrVertexNotFound). Depending on versioning strategy and definition of a breaking change, this may warrant a new major version.

This change also fixes a few issues I found in memoryStore:

To let the store handle error cases when it is part of its interface definition, undirected and directed:

And a few minor changes I made while I was there: