forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Move data-format-exception at a common place"
- Loading branch information
Showing
10 changed files
with
96 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package dataformat | ||
|
||
import "fmt" | ||
|
||
const ( | ||
// Version1x specifies the data format in version 1.x | ||
Version1x = "" | ||
|
||
// Version20 specifies the data format in version 2.0 | ||
Version20 = "2.0" | ||
) | ||
|
||
// ErrVersionMismatch is returned if it is detected that the version of the format recorded in | ||
// the internal database is different from what is specified in the `Conf` that is used for opening the db | ||
type ErrVersionMismatch struct { | ||
DBInfo string | ||
ExpectedVersion string | ||
Version string | ||
} | ||
|
||
func (e *ErrVersionMismatch) Error() string { | ||
return fmt.Sprintf("unexpected format. db info = [%s], data format = [%s], expected format = [%s]", | ||
e.DBInfo, e.Version, e.ExpectedVersion, | ||
) | ||
} | ||
|
||
// IsVersionMismatch returns true if err is an ErrVersionMismatch | ||
func IsVersionMismatch(err error) bool { | ||
_, ok := err.(*ErrVersionMismatch) | ||
return ok | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters