// When builds are canceled, the whole filesystem is being deleted. // However, the process (and build) keeps going. Because no files exist anymore, // the build eventually crashes with a randomly odd error. Those should not be // logged nor reported. // However builds canceled with `utils.build.cancelBuild()` should still show // "Build canceled by ..." const isCancelCrash = async function(error) { const { type } = getErrorInfo(error) if (type === 'cancelBuild') { return false } try { // TODO: find a better way to detect that the build is being cancelled. // Otherwise bugs due to (for example) the build command removing // `process.cwd` are currently not logged/reported. const cwd = getCwd() return !(await pathExists(cwd)) // `process.cwd()` fails when the current directory does not exist } catch (error) { return true } }