Skip to content

Improves error when retrieving app by objectId, Closes #6884#7171

Open
mvanhorn wants to merge 1 commit intopnp:mainfrom
mvanhorn:osc/6884-objectid-error-message
Open

Improves error when retrieving app by objectId, Closes #6884#7171
mvanhorn wants to merge 1 commit intopnp:mainfrom
mvanhorn:osc/6884-objectid-error-message

Conversation

@mvanhorn
Copy link
Copy Markdown

Summary

getAppRegistrationByObjectId now returns a clear error message when the objectId doesn't match any application, consistent with getAppRegistrationByAppId and getAppRegistrationByAppName.

Before: Resource 'xxx' does not exist or one of its queried reference-property objects are not present.
After: App with objectId 'xxx' not found in Microsoft Entra ID.

Changes

  • src/utils/entraApp.ts: Wrapped request.get in try/catch that intercepts 404 responses and throws a descriptive error. Non-404 errors are re-thrown unchanged.
  • src/utils/entraApp.spec.ts: Added test for the 404 error path.

Testing

  • 9/9 entraApp tests passing (added 1 new test)
  • managementapp-add tests passing (non-404 errors still propagate correctly)

Closes #6884

This contribution was developed with AI assistance (Claude Code).

Wraps request.get in getAppRegistrationByObjectId with a try/catch that
intercepts 404 responses and throws a friendly error message matching
the pattern used by getAppRegistrationByAppId and getAppRegistrationByAppName.

Fixes pnp#6884

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@milanholemans
Copy link
Copy Markdown
Contributor

Hi @mvanhorn thanks for the PR.
Next time, can you please comment on an issue you want to work on so we can assign it to you?
This way it's clear for everyone that an issue is claimed an 2 people cannot work on the same issue without them knowing.

@mvanhorn
Copy link
Copy Markdown
Author

Got it, will comment on the issue first next time. Thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent and unclear errors when retrieving an app by object ID

2 participants