Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View is never rejected when template is not found #121

Open
sebeling opened this issue Mar 30, 2012 · 1 comment
Open

View is never rejected when template is not found #121

sebeling opened this issue Mar 30, 2012 · 1 comment

Comments

@sebeling
Copy link

When creating an instance of a view and the Ajax call to retrieve the template fails (404, 500, etc), the error callback function is calling the checkText function with an empty string parameter, resulting in a "There is no template or an empty template at..." exception being thrown:

error: function() {
checkText("", url);
callback(404);
}

The exception terminates the rendering of the view and the view promise is never rejected. There is no way to determine that the rendering of the view failed and no way to perform custom error handling for the broken view. If the template cannot be found, the view should be rejected, allowing the error to be captured via the .fail callback function on the view promise:

var viewPromise = $.View('badTempatePath', { id: '123' });
$.when(viewPromise)
.done(function(markup) {
//Do something with template markup
})
.fail(function(){
//Handle broken view with custom error markup
});

@justinbmeyer
Copy link
Member

This needs to get fixed in CanJS. But thanks for reporting. It will be fixed in 3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants