Skip to content

Commit 97ddf3a

Browse files
committed
workspace build error
1 parent e856491 commit 97ddf3a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

coderd/autobuild/lifecycle_executor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
166166
Reason(reason)
167167

168168
if _, _, err := builder.Build(e.ctx, tx, nil); err != nil {
169-
log.Error(e.ctx, "unable to transition workspace",
169+
log.Error(e.ctx, "workspace build error",
170170
slog.F("transition", nextTransition),
171171
slog.Error(err),
172172
)

coderd/workspacebuilds.go

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"golang.org/x/exp/slices"
1515
"golang.org/x/xerrors"
1616

17+
"cdr.dev/slog"
18+
1719
"github.com/coder/coder/coderd/database"
1820
"github.com/coder/coder/coderd/database/db2sdk"
1921
"github.com/coder/coder/coderd/database/dbauthz"
@@ -348,6 +350,10 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
348350
)
349351
var buildErr wsbuilder.BuildError
350352
if xerrors.As(err, &buildErr) {
353+
if buildErr.Status == http.StatusInternalServerError {
354+
api.Logger.Error(ctx, "workspace build error", slog.Error(buildErr.Wrapped))
355+
}
356+
351357
httpapi.Write(ctx, rw, buildErr.Status, codersdk.Response{
352358
Message: buildErr.Message,
353359
Detail: buildErr.Error(),

coderd/workspaces.go

+4
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
454454
}, nil)
455455
var bldErr wsbuilder.BuildError
456456
if xerrors.As(err, &bldErr) {
457+
if bldErr.Status == http.StatusInternalServerError {
458+
api.Logger.Error(ctx, "workspace build error", slog.Error(bldErr.Wrapped))
459+
}
460+
457461
httpapi.Write(ctx, rw, bldErr.Status, codersdk.Response{
458462
Message: bldErr.Message,
459463
Detail: bldErr.Error(),

0 commit comments

Comments
 (0)