-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add error message for host having mdm off to host details (#23080)
relates to #22041 This adds an error message when refetching a host when mdm is not turned on for it. This was accidentally added to the My Device page, so we are moving it to the Host details page.
- Loading branch information
1 parent
010f80d
commit c71237d
Showing
3 changed files
with
19 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,6 @@ | ||
import { getErrorReason } from "interfaces/errors"; | ||
|
||
const DEFAULT_ERROR_MESSAGE = "refetch error."; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const getErrorMessage = (e: unknown, hostName: string) => { | ||
let errorMessage = getErrorReason(e, { | ||
reasonIncludes: "Host does not have MDM turned on", | ||
}); | ||
|
||
if (!errorMessage) { | ||
errorMessage = DEFAULT_ERROR_MESSAGE; | ||
} | ||
|
||
return `Host "${hostName}" ${errorMessage}`; | ||
return `Host "${hostName}" ${DEFAULT_ERROR_MESSAGE}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getErrorReason } from "interfaces/errors"; | ||
|
||
const DEFAULT_ERROR_MESSAGE = "refetch error."; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const getErrorMessage = (e: unknown, hostName: string) => { | ||
let errorMessage = getErrorReason(e, { | ||
reasonIncludes: "Host does not have MDM turned on", | ||
}); | ||
|
||
if (!errorMessage) { | ||
errorMessage = DEFAULT_ERROR_MESSAGE; | ||
} | ||
|
||
return `Host "${hostName}" ${errorMessage}`; | ||
}; |