From b66c734aeba2f06c4d0f10b6b250667c506a752c Mon Sep 17 00:00:00 2001 From: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> Date: Tue, 9 Nov 2021 14:42:46 -0600 Subject: [PATCH] UI: Show detailed error response on failed secret-engine list call (#13035) --- ui/app/adapters/secret-engine.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/app/adapters/secret-engine.js b/ui/app/adapters/secret-engine.js index ad8e3b7327..945240510f 100644 --- a/ui/app/adapters/secret-engine.js +++ b/ui/app/adapters/secret-engine.js @@ -31,14 +31,17 @@ export default ApplicationAdapter.extend({ mountModel = await this.ajax(this.internalURL(query.path), 'GET'); // if kv2 then add the config data to the mountModel // version comes in as a string - if (mountModel.data.type === 'kv' && mountModel.data.options.version === '2') { + if (mountModel?.data?.type === 'kv' && mountModel?.data?.options?.version === '2') { configModel = await this.ajax(this.urlForConfig(query.path), 'GET'); mountModel.data = { ...mountModel.data, ...configModel.data }; } } catch (error) { + // no path means this was an error on listing + if (!query.path) { + throw error; + } // control groups will throw a 403 permission denied error. If this happens return the mountModel // error is handled on routing - console.log(error); } return mountModel; },