Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • oss/libraries/go/application/configuration
1 result
Select Git revision
Show changes
Commits on Source (3)
<a name="v1.3.0"></a>
## [v1.3.0] - 2022-09-18
### Code Refactoring
- refactor error functions
<a name="v1.2.0"></a>
## [v1.2.0] - 2022-09-18
### Changes
......@@ -20,6 +26,7 @@
<a name="v1.0.0"></a>
## v1.0.0 - 2022-09-18
[v1.3.0]: https://gitlab.schukai.com/oss/libraries/go/application/configuration/compare/v1.2.0...v1.3.0
[v1.2.0]: https://gitlab.schukai.com/oss/libraries/go/application/configuration/compare/v1.1.0...v1.2.0
[v1.1.0]: https://gitlab.schukai.com/oss/libraries/go/application/configuration/compare/v1.0.1...v1.1.0
[v1.0.1]: https://gitlab.schukai.com/oss/libraries/go/application/configuration/compare/v1.0.0...v1.0.1
......@@ -37,16 +37,6 @@ func (s *setting[C]) SetMnemonic(mnemonic string) *setting[C] {
return s
}
// Check if the setting contains errors
func (s *setting[C]) HasErrors() bool {
return len(s.errors) > 0
}
// Get all errors
func (s *setting[C]) Errors() []error {
return s.errors
}
// Config() returns the configuration
func (s *setting[C]) Config() C {
return s.config
......
......@@ -5,6 +5,23 @@ import (
"reflect"
)
// ResetError is used to reset the error to nil
// After calling this function, the call HasErrors() will return false
func (s *setting[C]) ResetErrors() *setting[C] {
s.errors = []error{}
return s
}
// Check if the setting contains errors
func (s *setting[C]) HasErrors() bool {
return len(s.errors) > 0
}
// Get all errors
func (s *setting[C]) Errors() []error {
return s.errors
}
var FileNameEmptyError = errors.New("file name is empty")
var MnemonicEmptyError = errors.New("mnemonic is empty")
var NoFileImportedError = errors.New("no file imported")
......@@ -49,13 +66,6 @@ func newUnsupportedTypeError(t reflect.Type) UnsupportedTypeError {
return UnsupportedTypeError(errors.New("type " + t.String() + " is not supported"))
}
// ResetError is used to reset the error to nil
// After calling this function, the call HasErrors() will return false
func (s *setting[C]) ResetErrors() *setting[C] {
s.errors = []error{}
return s
}
// At the reflect level, some types are not supported
type UnsupportedReflectKindError error
......
......@@ -19,6 +19,8 @@ func TestResetErrors(t *testing.T) {
assert.True(t, c.HasErrors())
c.ResetErrors()
assert.False(t, c.HasErrors())
assert.Empty(t, c.Errors())
}
func TestNewFlagDoesNotExistError(t *testing.T) {
......
{"version":"1.2.0"}
{"version":"1.3.0"}