no need to create a variable for this.  just throw new Error('msg') works fine. And in fact, Error() is one of the magic built-in constructors that work when you call them as functions too, so you can leave out the new and just |throw Error('..');|. That's what I tend to do.

If you want to be fancier about this (not necessary, but optional) you could define a ready property on ImageEditor. Initialize to false and set it to true when you call the ready() callback. Then, instead of testing for the presence of the image, just test the readiness. Then your error message becomes something like "InvalidStateError".  Basically document on the constructor that you can't use the constructed object until the callback is called. And then enforce that restriction by adding ready checks to the public methods.