Skip to content

Commit

Permalink
catch errors in store.findRecord. #280
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 5, 2020
1 parent 9239a08 commit 7fe061f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/components/provider-show.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ export default Component.extend({
this.store.findRecord('provider', this.provider.get('id'), { backgroundReload: false }).then(function(provider) {
provider.destroyRecord().then(function() {
self.router.transitionTo('/providers');
}).catch(function(reason) {
console.debug(reason);
});
});
},
Expand Down
2 changes: 2 additions & 0 deletions app/components/repository-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export default Component.extend({
if (repo.get('certificates').length > 0) {
self.get('repository').set('certificate', A(repo.get('certificates')).mapBy('text'));
}
}).catch(function(reason) {
console.debug(reason);
});
} else {
this.repository.set('re3data', null);
Expand Down
4 changes: 4 additions & 0 deletions app/components/repository-show.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export default Component.extend({
if (repo.get('certificates').length > 0) {
self.get('repository').set('certificate', A(repo.get('certificates')).mapBy('text'));
}
}).catch(function(reason) {
console.debug(reason);
});
} else {
this.repository.set('re3data', null);
Expand Down Expand Up @@ -221,6 +223,8 @@ export default Component.extend({
repository.destroyRecord().then(function() {
self.router.transitionTo('providers.show.settings', self.get('provider'));
});
}).catch(function(reason) {
console.debug(reason);
});
},
cancel() {
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/dois/show/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default Controller.extend({
doi.destroyRecord().then(function() {
self.transitionToRoute('repositories.show.dois', self.get('repositoryId'));
});
}).catch(function(reason) {
console.debug(reason);
});
},
cancel() {
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/providers/show/prefixes/show/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default Controller.extend({
providerPrefix.destroyRecord().then(function() {
self.transitionToRoute('providers.show.prefixes', self.get('model.provider'));
});
}).catch(function(reason) {
console.debug(reason);
});
},
cancel() {
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/repositories/show/prefixes/show/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default Controller.extend({
repositoryPrefix.destroyRecord().then(function() {
self.transitionToRoute('repositories.show.prefixes', self.model.get('repository.id'));
});
}).catch(function(reason) {
console.debug(reason);
});
},
cancel() {
Expand Down
6 changes: 6 additions & 0 deletions app/routes/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ export default Route.extend(AuthenticatedRouteMixin, {
return this.store.findRecord('repository', this.currentUser.get('uid')).then(function(repository) {
repository.set('confirmSymbol', repository.get('symbol'));
return repository;
}).catch(function(reason) {
console.debug(reason);
});
} else if (this.currentUser.get('provider_id')) {
return this.store.findRecord('provider', this.currentUser.get('uid')).then(function(provider) {
provider.set('confirmSymbol', provider.get('symbol'));
return provider;
}).catch(function(reason) {
console.debug(reason);
});
} else if (this.currentUser.get('uid') === 'admin') {
return this.store.findRecord('provider', 'admin').then(function(provider) {
provider.set('confirmSymbol', provider.get('symbol'));
return provider;
}).catch(function(reason) {
console.debug(reason);
});
}
},
Expand Down
2 changes: 1 addition & 1 deletion app/routes/repositories/show/prefixes/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default Route.extend({

model() {
return hash({
repository: this.store.findRecord('repository', this.modelFor('repositories/show').get('id')),
repository: this.modelFor('repositories/show'),
prefix: this.store.createRecord('repositoryPrefix'),
});
},
Expand Down
Empty file removed app/templates/components/.gitkeep
Empty file.

0 comments on commit 7fe061f

Please sign in to comment.