Make tests pass for middleware
Add try/catch for catching errors from js-yaml