diff --git a/cmd/sst/ui/error.go b/cmd/sst/ui/error.go index e8a7843ac..e42adfefb 100644 --- a/cmd/sst/ui/error.go +++ b/cmd/sst/ui/error.go @@ -17,11 +17,14 @@ func parseError(input string) []string { if strings.Contains(input, "occurred:") { lines := []string{} - for _, line := range strings.Split(input, "\n") { + sections := strings.Split(input, "*") + for _, line := range sections[1:] { line = strings.TrimSpace(line) - if strings.HasPrefix(line, "*") { - splits := strings.Split(line, ":") - lines = append(lines, strings.TrimSpace(splits[len(splits)-1])) + splits := strings.Split(line, ":") + final := strings.TrimSpace(splits[len(splits)-1]) + + for _, split := range strings.Split(final, "\n") { + lines = append(lines, split) } } return lines diff --git a/cmd/sst/ui/ui.go b/cmd/sst/ui/ui.go index a6bd20cfc..2b27dfebf 100644 --- a/cmd/sst/ui/ui.go +++ b/cmd/sst/ui/ui.go @@ -273,7 +273,7 @@ func (u *UI) Trigger(evt *project.StackEvent) { Color: color.FgRed, Final: true, Label: "Error", - Message: parseError(evt.DiagnosticEvent.Message)[0], + Message: parseError(evt.DiagnosticEvent.Message), }) } @@ -338,7 +338,7 @@ func (u *UI) Trigger(evt *project.StackEvent) { if status.URN != "" { color.New(color.FgRed, color.Bold).Println(" " + formatURN(status.URN)) } - color.New(color.FgWhite).Println(strings.Join(parseError(status.Message), "\n")) + color.New(color.FgWhite).Println(" " + strings.Join(parseError(status.Message), "\n ")) } } } @@ -488,7 +488,7 @@ type Progress struct { Label string URN string Final bool - Message string + Message []string time.Duration } @@ -516,8 +516,12 @@ func (u *UI) printProgress(progress Progress) { if progress.Duration != 0 { color.New(color.FgHiBlack).Printf(" (%s)", progress.Duration) } - if progress.Message != "" { - color.New(color.FgHiBlack).Print(progress.Message) + if len(progress.Message) > 0 { + for _, item := range progress.Message { + fmt.Println() + color.New(progress.Color, color.Bold).Print("| ") + color.New(color.FgWhite).Print(item) + } } fmt.Println() u.hasProgress = true diff --git a/examples/test/sst.config.ts b/examples/test/sst.config.ts index 4c769e70b..7cddb48fa 100644 --- a/examples/test/sst.config.ts +++ b/examples/test/sst.config.ts @@ -12,11 +12,9 @@ export default $config({ }; }, async run() { - const fn = new sst.aws.Function("MyFunction", { - handler: "src/index.handler", - }); - new aws.s3.Bucket("MyBucket", { - bucket: "my-bucket", + new aws.dynamodb.Table("Web", { + name: "/aweofih", + billingMode: "PAY_PER_REQUEST", }); return {}; }, diff --git a/pkg/project/stack.go b/pkg/project/stack.go index f1d837a9a..482a9b9db 100644 --- a/pkg/project/stack.go +++ b/pkg/project/stack.go @@ -268,15 +268,19 @@ func (s *stack) Run(ctx context.Context, input *StackInput) error { if !ok { return } - input.OnEvent(&StackEvent{EngineEvent: event}) if event.DiagnosticEvent != nil && event.DiagnosticEvent.Severity == "error" { + if strings.HasPrefix(event.DiagnosticEvent.Message, "update failed") { + break + } complete.Errors = append(complete.Errors, Error{ Message: event.DiagnosticEvent.Message, URN: event.DiagnosticEvent.URN, }) } + input.OnEvent(&StackEvent{EngineEvent: event}) + if event.SummaryEvent != nil { complete.Finished = true }