diff options
author | Michael Muré <batolettre@gmail.com> | 2020-12-15 14:21:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-15 14:21:23 +0100 |
commit | 078c85be4ece0e3d3c1dd9b71c819fa70ea3348b (patch) | |
tree | 2db523e976d01ddf83625118f85f056139326cc4 /identity/version.go | |
parent | 0545ad6a6c478ddf8cf17c078df9e1c92a3f4083 (diff) | |
parent | e3737f216a7b6a36a2ba10146f2d228f32dcbcfb (diff) | |
download | git-bug-078c85be4ece0e3d3c1dd9b71c819fa70ea3348b.tar.gz |
Merge pull request #518 from MichaelMure/expose-format-version
expose format version
Diffstat (limited to 'identity/version.go')
-rw-r--r-- | identity/version.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/identity/version.go b/identity/version.go index 73e4d7c7..bbf93575 100644 --- a/identity/version.go +++ b/identity/version.go @@ -8,6 +8,7 @@ import ( "github.com/pkg/errors" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/lamport" "github.com/MichaelMure/git-bug/util/text" @@ -102,8 +103,11 @@ func (v *Version) UnmarshalJSON(data []byte) error { return err } - if aux.FormatVersion != formatVersion { - return fmt.Errorf("unknown format version %v", aux.FormatVersion) + if aux.FormatVersion < formatVersion { + return entity.NewErrOldFormatVersion(aux.FormatVersion) + } + if aux.FormatVersion > formatVersion { + return entity.NewErrNewFormatVersion(aux.FormatVersion) } v.time = aux.Time |