@stacksjs/error-handling 0.61.20 → 0.61.21

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/dist/index.js CHANGED
@@ -4453,10 +4453,32 @@ var require_index_cjs = __commonJS((exports) => {
4453
4453
  var fromPromise = ResultAsync.fromPromise;
4454
4454
  var fromSafePromise = ResultAsync.fromSafePromise;
4455
4455
  var fromAsyncThrowable = ResultAsync.fromThrowable;
4456
- var appendValueToEndOfList = (value) => (list) => [...list, value];
4457
- var combineResultList = (resultList) => resultList.reduce((acc, result) => acc.isOk() ? result.isErr() ? err(result.error) : acc.map(appendValueToEndOfList(result.value)) : acc, ok([]));
4456
+ var combineResultList = (resultList) => {
4457
+ let acc = ok([]);
4458
+ for (const result of resultList) {
4459
+ if (result.isErr()) {
4460
+ acc = err(result.error);
4461
+ break;
4462
+ } else {
4463
+ acc.map((list) => list.push(result.value));
4464
+ }
4465
+ }
4466
+ return acc;
4467
+ };
4458
4468
  var combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
4459
- var combineResultListWithAllErrors = (resultList) => resultList.reduce((acc, result) => result.isErr() ? acc.isErr() ? err([...acc.error, result.error]) : err([result.error]) : acc.isErr() ? acc : ok([...acc.value, result.value]), ok([]));
4469
+ var combineResultListWithAllErrors = (resultList) => {
4470
+ let acc = ok([]);
4471
+ for (const result of resultList) {
4472
+ if (result.isErr() && acc.isErr()) {
4473
+ acc.error.push(result.error);
4474
+ } else if (result.isErr() && acc.isOk()) {
4475
+ acc = err([result.error]);
4476
+ } else if (result.isOk() && acc.isOk()) {
4477
+ acc.value.push(result.value);
4478
+ }
4479
+ }
4480
+ return acc;
4481
+ };
4460
4482
  var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
4461
4483
  exports.Result = undefined;
4462
4484
  (function(Result) {
@@ -4726,7 +4748,7 @@ class ErrorHandler {
4726
4748
  }
4727
4749
  }
4728
4750
  static writeErrorToConsole(err) {
4729
- if (err === "Failed to execute command: bunx biome check --apply ." || err === "Failed to execute command: bun --bun storage/framework/core/actions/src/lint/fix.ts")
4751
+ if (err === "Failed to execute command: bunx biome check --fix" || err === "Failed to execute command: bun --bun storage/framework/core/actions/src/lint/fix.ts")
4730
4752
  console.error(err);
4731
4753
  process.exit(ExitCode.FatalError);
4732
4754
  console.error(err);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/error-handling",
3
3
  "type": "module",
4
- "version": "0.61.20",
4
+ "version": "0.61.21",
5
5
  "description": "Type safe error handling.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "@stacksjs/cli": "latest",
56
56
  "@stacksjs/path": "latest",
57
57
  "@stacksjs/types": "latest",
58
- "neverthrow": "^6.2.1"
58
+ "neverthrow": "^6.2.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@stacksjs/development": "latest"
package/src/handler.ts CHANGED
@@ -48,7 +48,7 @@ export class ErrorHandler {
48
48
 
49
49
  static writeErrorToConsole(err: string | Error | unknown): void {
50
50
  if (
51
- err === 'Failed to execute command: bunx biome check --apply .' ||
51
+ err === 'Failed to execute command: bunx biome check --fix' ||
52
52
  err === 'Failed to execute command: bun --bun storage/framework/core/actions/src/lint/fix.ts'
53
53
  )
54
54
  // To trigger this, run `buddy release` with a lint error in your codebase