mirror of
https://github.com/morluto/rea.git
synced 2026-11-10 00:36:35 +00:00
fix(analysis): preserve artifact and selection error ownership
This commit is contained in:
1 parent
69f99c5198
commit
4f212c6a30
11 files changed
+527
-25
No files matched your search
@@ -91,14 +91,24 @@ const selectIndexed = <Row>(
|
||||
): Result<Row, AnalysisError> => {
|
||||
const row = rows[index];
|
||||
if (row !== undefined) return ok(row);
|
||||
if (rows.length === 0)
|
||||
return err(
|
||||
inputError([
|
||||
{
|
||||
path: ["view", "selector", "index"],
|
||||
reason: "invalid_value",
|
||||
message: `No retained ${collection} entries can be selected by index.`,
|
||||
},
|
||||
]),
|
||||
);
|
||||
return err(
|
||||
inputError([
|
||||
{
|
||||
path: ["view", "selector", "index"],
|
||||
reason: "out_of_range",
|
||||
message: `${collection} index ${String(index)} is outside 0..${String(Math.max(0, rows.length - 1))} (${String(rows.length)} entries).`,
|
||||
message: `${collection} index ${String(index)} is outside 0..${String(rows.length - 1)} (${String(rows.length)} entries).`,
|
||||
minimum: 0,
|
||||
maximum: Math.max(0, rows.length - 1),
|
||||
maximum: rows.length - 1,
|
||||
},
|
||||
]),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user