feat: 更新错误处理,提供更清晰的路径错误信息

This commit is contained in:
Rogee
2025-09-10 14:41:58 +08:00
parent 7187205143
commit 8bcc2cbdad
2 changed files with 3 additions and 1 deletions

View File

@@ -2,7 +2,9 @@ package cmd
import (
"fmt"
"os"
"os/exec"
"path/filepath"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

View File

@@ -56,7 +56,7 @@ func commandGenRouteE(cmd *cobra.Command, args []string) error {
modulePath := filepath.Join(path, "app/http")
if _, err := os.Stat(modulePath); os.IsNotExist(err) {
log.Fatal("modules dir not exist, ", modulePath)
return fmt.Errorf("routes directory not found: %s (set --path to your project root)", modulePath)
}
// controllerPattern := regexp.MustCompile(`controller(_?\w+)?\.go`)