@@ -21,10 +21,13 @@ class JsonCacheTry implements JsonCache {
2121 Future <void > clear () async {
2222 try {
2323 await _wrapped.clear ();
24- } on Exception catch (ex) {
25- throw JsonCacheException (
26- extra: 'Error clearing cached data.' ,
27- exception: ex,
24+ } on Exception catch (ex, st) {
25+ Error .throwWithStackTrace (
26+ JsonCacheException (
27+ extra: 'Error clearing cached data.' ,
28+ exception: ex,
29+ ),
30+ st,
2831 );
2932 }
3033 }
@@ -36,10 +39,13 @@ class JsonCacheTry implements JsonCache {
3639 Future <void > refresh (String key, Map <String , dynamic > value) async {
3740 try {
3841 await _wrapped.refresh (key, value);
39- } on Exception catch (ex) {
40- throw JsonCacheException (
41- extra: "Error refreshing cached data at index '$key '." ,
42- exception: ex,
42+ } on Exception catch (ex, st) {
43+ Error .throwWithStackTrace (
44+ JsonCacheException (
45+ extra: "Error refreshing cached data at index '$key '." ,
46+ exception: ex,
47+ ),
48+ st,
4349 );
4450 }
4551 }
@@ -51,10 +57,13 @@ class JsonCacheTry implements JsonCache {
5157 Future <void > remove (String key) async {
5258 try {
5359 await _wrapped.remove (key);
54- } on Exception catch (ex) {
55- throw JsonCacheException (
56- extra: "Error removing cached data at index '$key '." ,
57- exception: ex,
60+ } on Exception catch (ex, st) {
61+ Error .throwWithStackTrace (
62+ JsonCacheException (
63+ extra: "Error removing cached data at index '$key '." ,
64+ exception: ex,
65+ ),
66+ st,
5867 );
5968 }
6069 }
@@ -66,10 +75,13 @@ class JsonCacheTry implements JsonCache {
6675 Future <Map <String , dynamic >?> value (String key) async {
6776 try {
6877 return await _wrapped.value (key);
69- } on Exception catch (ex) {
70- throw JsonCacheException (
71- extra: "Error retrieving cached data at index '$key '." ,
72- exception: ex,
78+ } on Exception catch (ex, st) {
79+ Error .throwWithStackTrace (
80+ JsonCacheException (
81+ extra: "Error retrieving cached data at index '$key '." ,
82+ exception: ex,
83+ ),
84+ st,
7385 );
7486 }
7587 }
@@ -81,10 +93,13 @@ class JsonCacheTry implements JsonCache {
8193 Future <bool > contains (String key) async {
8294 try {
8395 return await _wrapped.contains (key);
84- } on Exception catch (ex) {
85- throw JsonCacheException (
86- extra: "Error checking for cached data at index '$key '." ,
87- exception: ex,
96+ } on Exception catch (ex, st) {
97+ Error .throwWithStackTrace (
98+ JsonCacheException (
99+ extra: "Error checking for cached data at index '$key '." ,
100+ exception: ex,
101+ ),
102+ st,
88103 );
89104 }
90105 }
0 commit comments