informalsystems / themis-tracer

A tool for managing complex contexts for developing critical systems
Apache License 2.0
4 stars 0 forks source link

Report offending tag when duplicate unit tag is detected #63

Closed shonfeder closed 3 years ago

shonfeder commented 3 years ago

Currently, if you try to add a logical unit that is already in the db the error we get is

Error: Error while querying database: UNIQUE constraint failed: unit.tag

Caused by:
    0: UNIQUE constraint failed: unit.tag
    1: Error code 2067: A UNIQUE constraint failed

Instead, we need an output that is more along the lines of

Error: Trying to add a duplicate tag to the database: FOO.1::BAR.1

       Preexisting logical unit:

            tag:   FOO.1::BAR.1
            repo:  ./foo/bar
            file:  file/name.md

            content goes here

       New logical unit

            tag:   FOO.1::BAR.1
            repo:  ./fee/bee
            file:  file/nombre.md

            other content goes here

      Try changing the tag of one of these units to avoid the conflict and then run `tracer sync`.