Skip to content

Commit

Permalink
fix(core): ensure the error has message before reading indexOf #27078 (
Browse files Browse the repository at this point in the history
…#27426)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Project graph error handling is always expecting the `message` property
to exist on the error. This may not always be the case.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Only attempt to run `indexOf` if the `message` property exists.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27078
  • Loading branch information
Coly010 committed Aug 14, 2024
1 parent 17f09bc commit c56bfbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/project-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export async function createProjectGraphAndSourceMapsAsync(
);
return projectGraphAndSourceMaps;
} catch (e) {
if (e.message.indexOf('inotify_add_watch') > -1) {
if (e.message && e.message.indexOf('inotify_add_watch') > -1) {
// common errors with the daemon due to OS settings (cannot watch all the files available)
output.note({
title: `Unable to start Nx Daemon due to the limited amount of inotify watches, continuing without the daemon.`,
Expand Down

0 comments on commit c56bfbe

Please sign in to comment.