esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

`Error: build was canceled` is not actually an error. Consider changing it to "warn/log" or make it suppressible

Open nemosmithasf opened this issue 8 months ago • 1 comments

When you cancel a build via ctx.cancel(), it logs "Error: build was canceled".

However, this is not an error, because it was user initiated.

The current behaviour is confusing, since it implies that there's an error not being caught- when in fact, it's just a log message and no action is required.

It would be nice to be able to suppress it when the cancellation is user initiated, or at least change it to another head rather than "error".

nemosmithasf avatar Jun 26 '25 03:06 nemosmithasf

I agree that this isn't ideal, but I don't think it's super straightforward to fix this without changing the API. The public rebuild API in Go is defined as Rebuild() BuildResult and if the BuildResult has no errors, then the build result will look successful even when canceled. So that API would probably need to change. Adding the breaking label to this issue because it seems like a breaking change.

evanw avatar Jul 06 '25 23:07 evanw