Website: (Android proxy) Add deviceNotFound exit to four android proxy endpoints (#49918)

Changes:
- Updated the delete-android-device, get-android-device,
issue-command-on-android-device, and modify-android-device actions to
return a `deviceNotFound` response to Fleet servers when the Android
management API returns a 404 response.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
  - Improved Android device management error handling.
- Device deletion, retrieval, command issuance, and modification now
clearly report when the requested device cannot be found.
  - Prevents missing devices from being reported as generic errors.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Eric
2026-07-24 15:20:02 -05:00
committed by GitHub
parent 5c127e5fe4
commit eedfc5642c
4 changed files with 16 additions and 0 deletions
@@ -84,6 +84,7 @@ module.exports = {
notFound: { description: 'No Android enterprise found for this Fleet server.', responseType: 'notFound' },
enterpriseNotAccessible: { description: 'Fleet is not authorized to manage this Android enterprise.', responseType: 'notFound' },
deviceNoLongerManaged: { description: 'The specified device is no longer managed by the Android enterprise.', responseType: 'notFound' },
deviceNotFound: {description: 'The specified device does not exist in this Android enterprise', responseType: 'notFound'},
managementApiError: { statusCode: 503, description: 'The Android management API returned a transient 5xx error.' },
},
@@ -175,6 +176,9 @@ module.exports = {
}).intercept({status: 403}, ()=>{
// If the Android management API returns a 403 response, return a enterpriseNotAccessible (notFound) response to the Fleet server.
return {'enterpriseNotAccessible': 'Fleet is not authorized to manage this Android enterprise.'};
}).intercept({status: 404}, ()=>{
// If the Android management API returns a 404 response, return a deviceNotFound (notFound) response to the Fleet server.
return 'deviceNotFound';
}).intercept((err)=>{
let errorString = err.toString();
if (errorString.includes('Device is no longer being managed')) {