@@ -67,18 +67,23 @@ export class Subspace {
67
67
*/
68
68
public getPnpmOptions ( ) : PnpmOptionsConfiguration | undefined {
69
69
if ( ! this . _cachedPnpmOptionsInitialized ) {
70
+ // Calculate these outside the try/catch block since their error messages shouldn't be annotated:
71
+ const subspaceConfigFolder : string = this . getSubspaceConfigFolder ( ) ;
72
+ const subspaceTempFolder : string = this . getSubspaceTempFolder ( ) ;
70
73
try {
71
74
this . _cachedPnpmOptions = PnpmOptionsConfiguration . loadFromJsonFileOrThrow (
72
- `${ this . getSubspaceConfigFolder ( ) } /${ RushConstants . pnpmConfigFilename } ` ,
73
- this . getSubspaceTempFolder ( )
75
+ `${ subspaceConfigFolder } /${ RushConstants . pnpmConfigFilename } ` ,
76
+ subspaceTempFolder
74
77
) ;
75
78
this . _cachedPnpmOptionsInitialized = true ;
76
79
} catch ( e ) {
77
80
if ( FileSystem . isNotExistError ( e as Error ) ) {
78
81
this . _cachedPnpmOptions = undefined ;
79
82
this . _cachedPnpmOptionsInitialized = true ;
80
83
} else {
81
- throw new Error ( `The subspace has an invalid pnpm-config.json file: ${ this . subspaceName } ` ) ;
84
+ throw new Error (
85
+ `The subspace "${ this . subspaceName } " has an invalid pnpm-config.json file:\n` + e . message
86
+ ) ;
82
87
}
83
88
}
84
89
}
@@ -91,6 +96,12 @@ export class Subspace {
91
96
let subspaceConfigFolder : string ;
92
97
93
98
if ( rushConfiguration . subspacesFeatureEnabled ) {
99
+ if ( ! rushConfiguration . pnpmOptions . useWorkspaces ) {
100
+ throw new Error (
101
+ `The Rush subspaces feature is enabled. You must set useWorkspaces=true in pnpm-config.json.`
102
+ ) ;
103
+ }
104
+
94
105
// If this subspace doesn't have a configuration folder, check if it is in the project folder itself
95
106
// if the splitWorkspaceCompatibility option is enabled in the subspace configuration
96
107
0 commit comments