The whole point of a MaybeLocal is that it
may (or may not) contain a value. Calling .ToLocalChecked() on it is unsafe, unless you happen to know that it can't be empty.
shell.cc:416 is doing it wrong.
d8.cc:883 is doing it right.
A callback throwing an exception is the canonical example of a function that possibly returns no value, in which case its MaybeLocal return value is empty. The reason we've introduced MaybeLocals is so embedders can be sure they've covered all the places where they have to check for exceptions being thrown, since they can't accidentally convert from MaybeLocal to Local without explicitly checking for emptiness.