From 3549c911655cd1e921947e7e83de949f6c1e9e8d Mon Sep 17 00:00:00 2001 From: Ben Jervis Date: Thu, 23 May 2024 13:41:39 +1000 Subject: [PATCH] Add an error message to nullthrows (#9733) --- packages/core/core/src/requests/WriteBundlesRequest.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/core/src/requests/WriteBundlesRequest.js b/packages/core/core/src/requests/WriteBundlesRequest.js index 1559872e972b..4304a3c6c3bf 100644 --- a/packages/core/core/src/requests/WriteBundlesRequest.js +++ b/packages/core/core/src/requests/WriteBundlesRequest.js @@ -67,7 +67,10 @@ async function run({input, api, farm, options}) { if (bundle.isPlaceholder) { let hash = bundle.id.slice(-8); hashRefToNameHash.set(bundle.hashReference, hash); - let name = nullthrows(bundle.name).replace(bundle.hashReference, hash); + let name = nullthrows( + bundle.name, + `Expected ${bundle.type} bundle to have a name`, + ).replace(bundle.hashReference, hash); res.set(bundle.id, { filePath: joinProjectPath(bundle.target.distDir, name), type: bundle.type, // FIXME: this is wrong if the packager changes the type...