Skip to content

Commit

Permalink
Ensure we record the lockfile name when there's an error unmarshalling (
Browse files Browse the repository at this point in the history
#4180)

### Description

- Adds the name of the lockfile we tried to unmarshal to the error we
display when we fail to unmarshal it.

### Testing Instructions

Tested manually by editing Turbo's own lockfile to be invalid
  • Loading branch information
gsoltis committed Mar 13, 2023
1 parent db2fb5f commit a910bab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cli/internal/packagemanager/packagemanager.go
Expand Up @@ -5,12 +5,12 @@
package packagemanager

import (
"errors"
"fmt"
"path/filepath"
"regexp"
"strings"

"github.com/pkg/errors"
"github.com/vercel/turbo/cli/internal/fs"
"github.com/vercel/turbo/cli/internal/globby"
"github.com/vercel/turbo/cli/internal/lockfile"
Expand Down Expand Up @@ -181,7 +181,11 @@ func (pm PackageManager) ReadLockfile(projectDirectory turbopath.AbsoluteSystemP
if err != nil {
return nil, fmt.Errorf("reading %s: %w", pm.Lockfile, err)
}
return pm.UnmarshalLockfile(contents)
lf, err := pm.UnmarshalLockfile(contents)
if err != nil {
return nil, errors.Wrapf(err, "error in %v", pm.Lockfile)
}
return lf, nil
}

// PrunePatchedPackages will alter the provided pkgJSON to only reference the provided patches
Expand Down

0 comments on commit a910bab

Please sign in to comment.