From ed34d522ffcb63970f1b2ceea2c31acd2825f538 Mon Sep 17 00:00:00 2001 From: Thomas Hervey Date: Fri, 10 Aug 2018 15:02:19 -0600 Subject: [PATCH] updated: check entity type from second word as well --- modules/util/keepRight/keepRight_error.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/util/keepRight/keepRight_error.js b/modules/util/keepRight/keepRight_error.js index 069e56f65..8bbc647a4 100644 --- a/modules/util/keepRight/keepRight_error.js +++ b/modules/util/keepRight/keepRight_error.js @@ -99,13 +99,14 @@ export function parseErrorDescriptions(entity) { var currWord = errorDescriptions[i]; // strip leading # if present - if (currWord.charAt(0) === '#') { - currWord = currWord.slice(1, currWord.length); + if (currWord.charAt(0) === '#' || errorDescriptions[i-1] === '(id') { + currWord = currWord.replace(/\D/g,''); // get the entity type of the id var lastWord = errorDescriptions[i-1]; + var secondLastWord = errorDescriptions[i-2]; var base; - if (lastWord) { base = getEntityBase(lastWord); } + if (lastWord) { base = getEntityBase(lastWord) || getEntityBase(secondLastWord); } if (!base) { base = getEntityBase(parsedDescriptions.slice(-1)[0].split(' ').slice(-1)[0]); }