Why are blocked operator handled as a single operator inside a loop and not failed operator? Is there some logic behind that?
This is because when a Process reaches a point where there are no paths for the flow to continue down, the entire process is blocked. It doesn't matter if the blocking occurs within a loop, the process has no path to follow so it cannot complete the loop and the entire process immediately enters a blocked state.
In the case of your javascript exception, this is a 'Failed' result and as long as there is a Failed exit path the process will continue with whatever actions are appropriate and defined.
As a loop is treated by the orchestrator and the process as a self contained set of actions Exception handling is not called until the loop has completed.
So a javascript error within a loop will not trigger exception handling until the loop completes; unless there is no valid path for the loop to complete, in which case the entire process enters a blocked state.
I agree that it would be nice to be able to trigger exception handling within a loop and have given your IDEA an up vote.