-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: attempt to fetch the db if it was not found
- Loading branch information
1 parent
592fbf5
commit 68ac5fd
Showing
3 changed files
with
57 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package errortypes | ||
|
||
type ErrorDatabaseNotFound struct { | ||
Message string `json:"message"` | ||
FileName string `json:"-"` | ||
StatusCode int `json:"-"` | ||
Err error `json:"-"` | ||
} | ||
|
||
func (e *ErrorDatabaseNotFound) Error() string { | ||
return "Database file not found" | ||
} | ||
|
||
func (e *ErrorDatabaseNotFound) Unwrap() error { | ||
return e.Err | ||
} | ||
|
||
func NewErrorDatabaseNotFound(err error, filename string) *ErrorDatabaseNotFound { | ||
return &ErrorDatabaseNotFound{ | ||
FileName: filename, | ||
Message: "We couldn't access the database, please contact the administrator", | ||
StatusCode: 500, | ||
Err: err, | ||
} | ||
} |
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