diff --git a/website/api/controllers/android-proxy/delete-android-device.js b/website/api/controllers/android-proxy/delete-android-device.js index 71525057a8..e728dd9f58 100644 --- a/website/api/controllers/android-proxy/delete-android-device.js +++ b/website/api/controllers/android-proxy/delete-android-device.js @@ -27,6 +27,7 @@ module.exports = { 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' }, managementApiError: { statusCode: 503, description: 'The Android management API returned a transient 5xx error.' }, + deviceNotFound: {description: 'The specified device does not exist in this Android enterprise', responseType: 'notFound'}, }, @@ -76,6 +77,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')) { diff --git a/website/api/controllers/android-proxy/get-android-device.js b/website/api/controllers/android-proxy/get-android-device.js index d59ee423c3..a00a36864b 100644 --- a/website/api/controllers/android-proxy/get-android-device.js +++ b/website/api/controllers/android-proxy/get-android-device.js @@ -26,6 +26,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 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'} }, @@ -77,6 +78,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')) { diff --git a/website/api/controllers/android-proxy/issue-command-on-android-device.js b/website/api/controllers/android-proxy/issue-command-on-android-device.js index 794e4912d8..05a81d4c1d 100644 --- a/website/api/controllers/android-proxy/issue-command-on-android-device.js +++ b/website/api/controllers/android-proxy/issue-command-on-android-device.js @@ -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')) { diff --git a/website/api/controllers/android-proxy/modify-android-device.js b/website/api/controllers/android-proxy/modify-android-device.js index fd69c4fba2..fe8526caad 100644 --- a/website/api/controllers/android-proxy/modify-android-device.js +++ b/website/api/controllers/android-proxy/modify-android-device.js @@ -28,6 +28,7 @@ module.exports = { deviceNoLongerManaged: { description: 'The device is no longer managed by the Android enterprise.', responseType: 'notFound' }, invalidPolicyName: {description: 'The specified policy_name is invalid', responseType: 'badRequest' }, managementApiError: { statusCode: 503, description: 'The Android management API returned a transient 5xx error.' }, + deviceNotFound: {description: 'The specified device does not exist in this Android enterprise', responseType: 'notFound'} }, @@ -82,6 +83,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')) {