Handle errors during locals resolution.

Previously we had a gap in the promise chain during the flatten phase,
where we failed to propagate up errors we encountered. Now we propagate
errors all the way up and ultimately treat them the same way as we'd
treat a missing route, which the caller should then handle as a
"not found" error.