diff --git a/ui/app/utils/message-from-adapter-error.js b/ui/app/utils/message-from-adapter-error.js index 2b1ce864b..8641576ac 100644 --- a/ui/app/utils/message-from-adapter-error.js +++ b/ui/app/utils/message-from-adapter-error.js @@ -1,6 +1,14 @@ +import { ForbiddenError } from '@ember-data/adapter/error'; + // Returns a single string based on the response the adapter received -export default function messageFromAdapterError(error) { - if (error.errors) { +export default function messageFromAdapterError(error, actionMessage) { + if (error instanceof ForbiddenError) { + return `Your ACL token does not grant permission to ${actionMessage}.`; + } + + if (error.errors?.length) { return error.errors.mapBy('detail').join('\n\n'); } + + return 'Unknown Error'; }