mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Don't ignore synchronous errors when calling Node
This commit is contained in:
@@ -31,17 +31,21 @@ function findAngularComponent(options) {
|
||||
|
||||
module.exports = {
|
||||
renderToString: function(callback, options) {
|
||||
var component = findAngularComponent(options);
|
||||
var serverBindings = [
|
||||
ngRouter.ROUTER_BINDINGS,
|
||||
ngUniversal.HTTP_PROVIDERS,
|
||||
ng.provide(ngUniversal.BASE_URL, { useValue: options.requestUrl }),
|
||||
ngUniversal.SERVER_LOCATION_PROVIDERS
|
||||
];
|
||||
try {
|
||||
var component = findAngularComponent(options);
|
||||
var serverBindings = [
|
||||
ngRouter.ROUTER_BINDINGS,
|
||||
ngUniversal.HTTP_PROVIDERS,
|
||||
ng.provide(ngUniversal.BASE_URL, { useValue: options.requestUrl }),
|
||||
ngUniversal.SERVER_LOCATION_PROVIDERS
|
||||
];
|
||||
|
||||
return ngUniversal.renderToString(component, serverBindings).then(
|
||||
function(successValue) { callback(null, successValue); },
|
||||
function(errorValue) { callback(errorValue); }
|
||||
);
|
||||
return ngUniversal.renderToString(component, serverBindings).then(
|
||||
function(successValue) { callback(null, successValue); },
|
||||
function(errorValue) { callback(errorValue); }
|
||||
);
|
||||
} catch (synchronousException) {
|
||||
callback(synchronousException);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user