Skip to content

Commit

Permalink
fix(read): improve incompatibility error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickersoft committed Jan 15, 2024
1 parent 19d5691 commit 39a7103
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ github.com/TheOpenDictionary/odict/lib/test v0.0.0-20240109012151-688e6c29aa28/g
github.com/TheOpenDictionary/odict/lib/types v0.0.0-20230921060249-e2cb2527d998/go.mod h1:CFu/SVhm/v0fio+DwrsEgTCMLFctZcJbZxe4Ch5MY2U=
github.com/TheOpenDictionary/odict/lib/types v0.0.0-20231031041149-dd406d841689/go.mod h1:EyG+XUeVlK9nKtKexShKWlVwN2qd6Z4KoYdENtQlyT4=
github.com/TheOpenDictionary/odict/lib/utils v0.0.0-20230921060249-e2cb2527d998/go.mod h1:J+wpUCVDLh4i6YWJPMFVNMT/rK/6H08fNpzgxrrdTtY=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
3 changes: 2 additions & 1 deletion lib/core/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io/ioutil"
"os"
"strconv"
Expand Down Expand Up @@ -70,7 +71,7 @@ func readODictBytes(data []byte) (*ODictFile, error) {

// Assert version
if readVersion != uint16(expectedVersion) {
return nil, errors.New("this file is not compatible with the latest version of the ODict schema")
return nil, errors.New(fmt.Sprintf("this file is not compatible with the latest version of the ODict schema. This file uses version %d of the specification, while your CLI uses version %d. Please upgrade.", readVersion, expectedVersion))
}

// Read compressed buffer content as bytes
Expand Down

0 comments on commit 39a7103

Please sign in to comment.