How to handle unexpected modal box for every action in test script?

I did use method of @ kazurayam
from How to Highlight Test object in each and every step to run a function to check for unexpected modal in each step

The problem is that it will take very long to complete execution as it performs a check beofre invoking a method. If I check for system error before invoking method then check should be performed for all built in keywords and the script is becoming very slow.As well if system error occurs after last action being completed.It will not capture that.

If anyone can help to say how can I do similarly after built in keyword method execution is completed.
It will be helpful so that I can check for system error only when some action is performed on webpage example click or selection

Below is the code which I used from ://forum.katalon.com/t/how-to-highlight-test-object-in-each-and-every-step/17408/4 .

public class TestObjectListener {

@Keyword
public static void on(TestObject testObject) {
	influence(testObject)
}

private static List<String> influencedKeywords = [
	'click',
	'setEncryptedText',
	'setText',
	'mouseOver',
	'scrollToElement',
	'scrollToPosition',
	'verifyElementVisible',
	'verifyOptionSelectedByLabel',
	'verifyOptionPresentByLabel',
	'verifyElementNotClickable',
	'verifyElementClickable',
	'verifyElementPresent',
	'waitForElementVisible',
	'waitForElementPresent',
	'waitForElementNotVisible',
	'waitForElementClickable',
	'waitForElementNotPresent',
	'waitForElementPresent',
	'getText',
	'getAttribute'
]



private static void influence(TestObject testObject) {
	try {
		WebDriver driver = DriverFactory.getWebDriver()
			boolean	error = WebUI.verifyElementPresent(findTestObject('Page_WelcometoSCMIT/SystemErrorText'),1)

			println(error)
			if(error ){

				WebUI.takeScreenshot()
			}
	} catch (Exception e) {
		e.printStackTrace()
	}
}



@Keyword
public static void pandemic() {
	WebUI.metaClass.'static'.invokeMethod = { String name, args ->
		if (name in influencedKeywords) {
			println(name)
			TestObject to = (TestObject)args[0]
			TestObjectListener.on(to)
		}
		def result
		try {
			result = delegate.metaClass.getMetaMethod(name, args).invoke(delegate, args)
		} catch(Exception e) {
			System.out.println("Handling exception for method $name")
		}
		return result
	}
}

}

Plese help if anyone knows how to call a function after built in keyword completes exection