Adding errors with js in v2

I am migrating from v1 to v2 in Skuid 15.0.7. I was using an error message system similar to what is discussed here however the same system doesn’t work in v2 even when I add a blank Title with the same unique ID as the Page Title in the v1 version of the page (It seems when migrating the Page Title component was removed and the closest alternative in v2 is Title).
This is the code I used previously to display an error through JavaScript.

var pageTitle = $('#PageTitle');
var editor = pageTitle.data('object').editor;
if("some condition"){
    editor.handleMessages(
         [{
            message: 'some message',
            severity: 'ERROR'
       }]
    );
    return false;
}

But now I’m getting this error


I’m assuming this is because It’s not able to access the component with the unique Id specifies because the component (Title in v2) does not support it or it doesn’t have the editor object. In either case what is the alternative the can be used to achieve the same result in v2?

We introduced the message block in V2 to allow declarative population of error messaging and other notifications. Revise your script to control a boolean - and conditionally render the message block based on that boolean.

But you are right - we removed a lot of code based access to components in V2.