Permalink
Browse files

feat(route-href): report errors via aurelia-logging

  • Loading branch information...
1 parent f7612d6 commit ac8dc0fb9ff03978f6dbe63b39b379505bd7050c @bryanrsmith bryanrsmith committed Oct 25, 2015
Showing with 18 additions and 8 deletions.
  1. +1 −0 README.md
  2. +1 −0 config.js
  3. +1 −0 package.json
  4. +15 −8 src/route-href.js
View
@@ -14,6 +14,7 @@ This library is part of the [Aurelia](http://www.aurelia.io/) platform and conta
* [aurelia-dependency-injection](https://github.com/aurelia/dependency-injection)
* [aurelia-path](https://github.com/aurelia/path)
* [aurelia-metadata](https://github.com/aurelia/metadata)
+* [aurelia-logging](https://github.com/aurelia/logging)
## Used By
View
@@ -15,6 +15,7 @@ System.config({
map: {
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.11.0",
+ "aurelia-logging": "github:aurelia/logging@0.8.0",
"aurelia-metadata": "github:aurelia/metadata@0.9.0",
"aurelia-pal": "github:aurelia/pal@0.2.0",
"aurelia-path": "github:aurelia/path@0.10.0",
View
@@ -26,6 +26,7 @@
},
"dependencies": {
"aurelia-dependency-injection": "github:aurelia/dependency-injection@^0.11.0",
+ "aurelia-logging": "github:aurelia/logging@^0.8.0",
"aurelia-metadata": "github:aurelia/metadata@^0.9.0",
"aurelia-pal": "github:aurelia/pal@^0.2.0",
"aurelia-path": "github:aurelia/path@^0.10.0",
View
@@ -2,6 +2,9 @@ import {customAttribute, bindable} from 'aurelia-templating';
import {inject} from 'aurelia-dependency-injection';
import {Router} from 'aurelia-router';
import {DOM} from 'aurelia-pal';
+import * as LogManager from 'aurelia-logging';
+
+const logger = LogManager.getLogger('route-href');
@customAttribute('route-href')
@bindable({name: 'route', changeHandler: 'processChange'})
@@ -32,13 +35,17 @@ export class RouteHref {
}
processChange() {
- this.router.ensureConfigured().then(() => {
- if (!this.isActive) {
- return;
- }
-
- let href = this.router.generate(this.route, this.params);
- this.element.setAttribute(this.attribute, href);
- });
+ return this.router.ensureConfigured()
+ .then(() => {
+ if (!this.isActive) {
+ return;
+ }
+
+ let href = this.router.generate(this.route, this.params);
+ this.element.setAttribute(this.attribute, href);
+ })
+ .catch(reason => {
+ logger.error(reason);
+ });
}
}

0 comments on commit ac8dc0f

Please sign in to comment.