Skip to content
This repository was archived by the owner on Aug 18, 2018. It is now read-only.

Commit c607a7b

Browse files
committed
problems solved with uncatched promises
1 parent b37f173 commit c607a7b

File tree

8 files changed

+7317
-13
lines changed

8 files changed

+7317
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Service with `toServer()` and `fromServer()` functions. They execute before and after http request. Ideal for type conversions.
1313
- `JsonapiCore.duplicateResource(resouce, ...relationtypes)` return a duplication of resource. You can duplicate resources and, optionally, their relationships. (v0.6.16)
1414
- resource save() method return a promise.
15+
- Fix problem with `Possibly unhandled rejection: undefined` with new AngularJs.
1516

1617
## No more declaration file .d.ts
1718

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-angular-jsonapi",
3-
"version": "0.6.29",
3+
"version": "0.6.30",
44
"description": "JSONAPI library developed for AngularJS in Typescript",
55
"repository": {
66
"type": "git",
@@ -19,10 +19,10 @@
1919
"@types/angular-ui-router": "^1.1.36",
2020
"@types/es6-shim": "^0.31.32",
2121
"@types/jasmine": "^2.5.43",
22-
"@types/jquery": "^2.0.40",
23-
"@types/node": "^7.0.5",
22+
"@types/jquery": "^3.2.6",
23+
"@types/node": "^8.0.8",
2424
"angular-mocks": "^1.6.2",
25-
"angular-ui-router": "1.0.0-beta.3",
25+
"angular-ui-router": "1.0.3",
2626
"autoprefixer": "^6.7.3",
2727
"babel-eslint": "^7.1.1",
2828
"babel-loader": "^6.3.2",
@@ -33,7 +33,7 @@
3333
"declaration-bundler-webpack-plugin": "^1.0.3",
3434
"del": "^2.2.2",
3535
"es6-shim": "^0.35.3",
36-
"eslint": "^3.15.0",
36+
"eslint": "^4.1.1",
3737
"eslint-config-angular": "^0.5.0",
3838
"eslint-config-xo-space": "^0.15.0",
3939
"eslint-loader": "^1.6.1",

src/library/resource.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ export class Resource extends ParentResourceService implements IResource {
184184

185185
this.runFc(fc_success, success);
186186
deferred.resolve(success);
187-
},
187+
}
188+
).catch(
188189
error => {
189190
this.is_saving = false;
190191
this.runFc(fc_error, 'data' in error ? error.data : error);

src/library/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class Service extends ParentResourceService implements IService {
102102
deferred.promise.then(fc_success => {
103103
this.runFc(fc_success, 'cachememory');
104104
})
105-
// .catch(() => {})
105+
.catch(() => {})
106106
;
107107
resource.is_loading = false;
108108
return resource;

src/library/services/noduplicatedhttpcalls.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export class NoDuplicatedHttpCallsService {
3333
}
3434
delete this.calls[path];
3535
}
36-
},
36+
}
37+
).catch(
3738
error => {
3839
if (path in this.calls) {
3940
for (let deferred of this.calls[path]) {

src/library/sources/http.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export class Http {
6060
Core.me.refreshLoadings(-1);
6161
deferred.resolve(success);
6262
}, self.rsJsonapiConfig.delay);
63-
},
63+
}
64+
).catch(
6465
error => {
6566
Core.me.refreshLoadings(-1);
6667
if (error.status <= 0) {

src/library/sources/store.service.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export class StoreService {
2626
} else {
2727
this.globalstore.setItem('_lastclean_time', { time: Date.now() });
2828
}
29+
})
30+
.catch(() => {
31+
this.globalstore.setItem('_lastclean_time', { time: Date.now() });
2932
});
3033
}
3134

@@ -39,9 +42,12 @@ export class StoreService {
3942
// removemos!!
4043
this.allstore.removeItem(key);
4144
}
42-
});
45+
})
46+
.catch( () => {} );
47+
;
4348
});
44-
});
49+
})
50+
.catch( () => {} );
4551
}
4652

4753
public getObjet(key: string): Promise<object> {
@@ -85,10 +91,14 @@ export class StoreService {
8591
this.allstore.getItem(key).then(success2 => {
8692
success2['_lastupdate_time'] = 0;
8793
this.allstore.setItem(key, success2);
88-
});
94+
})
95+
.catch( () => {} )
96+
;
8997
}
9098
});
91-
});
99+
})
100+
.catch( () => {} )
101+
;
92102
}
93103
}
94104

0 commit comments

Comments
 (0)