mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 08:24:27 +00:00
Unify errors
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -114,7 +113,7 @@ func (fs *FileSystem) FindFileByName(userID, workspaceID int, filename string) (
|
||||
}
|
||||
|
||||
if len(foundPaths) == 0 {
|
||||
return nil, errors.New("file not found")
|
||||
return nil, fmt.Errorf("file not found")
|
||||
}
|
||||
|
||||
return foundPaths, nil
|
||||
@@ -171,7 +170,7 @@ func (fs *FileSystem) GetFileStats(userID, workspaceID int) (*FileCountStats, er
|
||||
|
||||
// Check if workspace exists
|
||||
if _, err := os.Stat(workspacePath); os.IsNotExist(err) {
|
||||
return nil, errors.New("workspace directory does not exist")
|
||||
return nil, fmt.Errorf("workspace directory does not exist")
|
||||
}
|
||||
|
||||
return fs.countFilesInPath(workspacePath)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"novamd/internal/gitutils"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func (fs *FileSystem) DisableGitRepo(userID, workspaceID int) {
|
||||
func (fs *FileSystem) StageCommitAndPush(userID, workspaceID int, message string) error {
|
||||
repo, ok := fs.getGitRepo(userID, workspaceID)
|
||||
if !ok {
|
||||
return errors.New("git settings not configured for this workspace")
|
||||
return fmt.Errorf("git settings not configured for this workspace")
|
||||
}
|
||||
|
||||
if err := repo.Commit(message); err != nil {
|
||||
@@ -43,7 +43,7 @@ func (fs *FileSystem) StageCommitAndPush(userID, workspaceID int, message string
|
||||
func (fs *FileSystem) Pull(userID, workspaceID int) error {
|
||||
repo, ok := fs.getGitRepo(userID, workspaceID)
|
||||
if !ok {
|
||||
return errors.New("git settings not configured for this workspace")
|
||||
return fmt.Errorf("git settings not configured for this workspace")
|
||||
}
|
||||
|
||||
return repo.Pull()
|
||||
|
||||
Reference in New Issue
Block a user