Executing javascript alert error - Debug Mode

Tried to run the below code as one of the steps in debug mode.

WebUI.executeJavaScript("alert('This is an alert1')", null)

In the debug mode it throws the below error.

09-10-2018 01:27:43 PM - [ERROR]  - Test Cases/Coupon/verifyGeneralCouponAllMethods FAILED because (of) (Stack trace: org.openqa.selenium.UnhandledAlertException: unexpected alert open: {Alert text : This is an alert1}

Is there any option i missed to additionally set in the javascript?