marionettejs/backbone.marionette — pull request #1826 by paulfalgout (2014-09-03 02:18:08+00:00)
Title: Have region throw ViewDestroyError for error handling

Having the region check for `view.isDestroyed` does two things:

1: It allows you to handle the error of a `region.show` without the region killing the `currentView` and breaking without recourse.

```javascript
var foo_view = new FooView();
someRegion.show(foo_view);

var bar_view = new BarView();
someRegion.show(bar_view);

try{
someRegion.show(foo_view);
} catch(e){
// Should log ViewDestroyError
console.log(e.name);

// Without destroying bar_view
console.log('Is Destroyed? ' + !!bar_view.isDestroyed);
}
```

2: Appending `isDestroyed` to a `Backbone.View` on `region.empty` adds the same safety for not re-showing a removed backbone view.

The extra `return this;` was removed to prevent jslint error for too many statements, and seemed unnecessary