statusboard icon indicating copy to clipboard operation
statusboard copied to clipboard

handle rejecting with multiple errors in one place

Open nlf opened this issue 4 years ago • 1 comments

currently workspace supporting commands have to run a method on n workspaces, and if one of them fails it must catch the error itself, log it, set the exitCode and then continue the loop.

it would be nice if we had a centralized way to handle these errors like we do for non-workspace contexts. rejecting the promise or calling the callback with an error should allow the framework to log multiple errors appropriately.

another thing to consider here, is do we want to gather all the errors and print them all at the end? do we want to print each error as it occurs so that output and errors are mixed, but next to each other?

nlf avatar Mar 30 '21 15:03 nlf

https://npmjs.com/promise.allsettled may help here.

As for the output, I'd suggest following lerna's approach and prefixing each line of log output with the workspace name, and doing best-effort grouping.

ljharb avatar Mar 30 '21 16:03 ljharb