Fix #375: throwing an :error inside a middleware doesn't respect the format setting. The api.format environment has not been set, yet.