diff --git a/README.md b/README.md index a9d6b82..707a391 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ for (const item of items) { item.fields.priority, item.type === "REDACTED" ? "_redacted_" - : item.content.assignees.map(({ login }) => login).join(","), + : item.content.assignees.map(({ login }) => login).join(",") ); } @@ -484,7 +484,7 @@ Resolves with `undefined` if item cannot be found. ```js const item = await project.items.getByContentRepositoryAndNumber( repositoryName, - issueOrPullRequestNumber, + issueOrPullRequestNumber ); ``` @@ -794,7 +794,7 @@ Archives a single item based on the Node ID of its linked issue or pull request. ```js await project.items.archiveByContentRepositoryAndNumber( repositoryName, - issueOrPullRequestNumber, + issueOrPullRequestNumber ); ``` @@ -927,7 +927,7 @@ Removes a single item based on the Node ID of its linked issue or pull request. ```js await project.items.removeByContentRepositoryAndNumber( repositoryName, - issueOrPullRequestNumber, + issueOrPullRequestNumber ); ``` @@ -1000,7 +1000,7 @@ try { details: error.details, // log out helpful human-readable error message, but beware that it likely contains user content }, - error.toHumanMessage(), + error.toHumanMessage() ); } else { // handle any other error @@ -1032,7 +1032,36 @@ try { code: error.code, details: error.details, }, - error.toHumanMessage(), + error.toHumanMessage() + ); + } + + throw error; +} +``` + +#### `GitHubProjectNotFoundError` + +Thrown when a project cannot be found based on the `owner` and `number` passed to the `Project` constructor. The error is also thrown if the project exists but cannot be found based on authentication. + +```js +import Project, { GitHubProjectNotFoundError } from "github-project"; + +try { + await myScript(new Project(options)); +} catch (error) { + if (error instanceof GitHubProjectNotFoundError) { + analytics.track("GitHubProjectNotFoundError", { + owner: error.details.owner, + number: error.details.number, + }); + + myLogger.error( + { + code: error.code, + details: error.details, + }, + error.toHumanMessage() ); } @@ -1062,7 +1091,7 @@ try { constant - GitHubProjectUnknownFieldError + GitHubProjectNotFoundError @@ -1156,7 +1185,7 @@ try { code: error.code, details: error.details, }, - error.toHumanMessage(), + error.toHumanMessage() ); } @@ -1332,7 +1361,7 @@ try { code: error.code, details: error.details, }, - error.toHumanMessage(), + error.toHumanMessage() ); }