Use param.get("$$xspsubmitid") to get eventHandler triggering the process that causes the error. Use getParent() from eventHandler to get component triggering the process.
Need to handle if the component does not have id.
Maybe have a separate method that, if there's an error, just returns a blank string??