forked from cloudfoundry/stratos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add errorz package to combine errors as enum in there (#47)
* feat: add errorz package to combine errors as enum in there * feat: missed duplicated error * fix: not worked error checks * fix: not worked error checks * rename error package * applied JRA's suggestions * applied JRA's suggestions * fix error in test suite --------- Co-authored-by: Nedim Akar <[email protected]> Co-authored-by: Nedim Akar <[email protected]> Co-authored-by: Jan-Robin Aumann <[email protected]>
- Loading branch information
1 parent
83683da
commit 61e3c00
Showing
9 changed files
with
80 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package constants | ||
|
||
const ( | ||
ERR_GOOSE_DB_NO_DATABASE_VERSIONS_FOUND = "pgsql_goosedb: no database versions found" | ||
ERR_GOOSE_DB_NO_SUCH_TABLE = "pgsql_goosedb: no such table" | ||
ERR_GOOSE_DB_FAILED_GETTING_CURRENT_DATABASE_VERSION = "pgsql_goosedb: error trying to get current database version: %w" | ||
) |
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,26 @@ | ||
package custom_errors | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cloudfoundry-incubator/stratos/src/jetstream/custom_errors/constants" | ||
) | ||
|
||
type GooseDBNoDatabaseVersionsFoundError struct{} | ||
|
||
func (e GooseDBNoDatabaseVersionsFoundError) Error() string { | ||
return constants.ERR_GOOSE_DB_NO_DATABASE_VERSIONS_FOUND | ||
} | ||
|
||
type GooseDBNoSuchTableError struct{} | ||
|
||
func (e GooseDBNoSuchTableError) Error() string { | ||
return constants.ERR_GOOSE_DB_NO_SUCH_TABLE | ||
} | ||
|
||
func ErrGettingCurrentVersion(err error) error { | ||
return fmt.Errorf(constants.ERR_GOOSE_DB_FAILED_GETTING_CURRENT_DATABASE_VERSION, err) | ||
} | ||
|
||
var ErrNoDatabaseVersionsFound = GooseDBNoDatabaseVersionsFoundError{} | ||
var ErrNoSuchTable = GooseDBNoSuchTableError{} |
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