Canvas Error function shows error in canvas instead of Alert