@asmlift/core 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/rank.ts +9 -1
package/package.json
CHANGED
package/src/rank.ts
CHANGED
|
@@ -2234,8 +2234,12 @@ export function rankBy<S extends { score: number; rows?: number }>(
|
|
|
2234
2234
|
if (results.length === 0) {
|
|
2235
2235
|
// Naming the withheld count matters here: "no scorable candidate" with a null cause reads as a
|
|
2236
2236
|
// scorer failure, and a list that was entirely proof-gated is a different thing entirely.
|
|
2237
|
+
// NOT `firstLine`: a compile failure puts the COMMAND on line one and the compiler's own
|
|
2238
|
+
// complaint after it, so summarising to one line published the thing the reader already knows
|
|
2239
|
+
// and dropped the only sentence that says what went wrong. The per-candidate `dropped` list
|
|
2240
|
+
// above stays one line each — it is a roster, not a diagnosis.
|
|
2237
2241
|
const why =
|
|
2238
|
-
lastScoreErr !== null ?
|
|
2242
|
+
lastScoreErr !== null ? fullMessage(lastScoreErr) : `${withheld.length} candidate(s) withheld, none scored`;
|
|
2239
2243
|
throw new NoScorableCandidateError(`no scorable candidate for '${symbol}': ${why}`, dropped, withheld, {
|
|
2240
2244
|
cause: lastScoreErr,
|
|
2241
2245
|
});
|
|
@@ -2343,3 +2347,7 @@ function castCount(source: string): number {
|
|
|
2343
2347
|
function firstLine(e: unknown): string {
|
|
2344
2348
|
return e instanceof Error ? e.message.split('\n')[0] : String(e);
|
|
2345
2349
|
}
|
|
2350
|
+
|
|
2351
|
+
function fullMessage(e: unknown): string {
|
|
2352
|
+
return e instanceof Error ? e.message : String(e);
|
|
2353
|
+
}
|