File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -110,22 +110,25 @@ class Client {
110110
111111 try {
112112 if(headers['content-type'] == 'multipart/form-data') {
113- return http.request(path, data: FormData.fromMap(params), options: options);
113+ return await http.request(path, data: FormData.fromMap(params), options: options);
114114 }
115115
116116 if (method == HttpMethod.get) {
117117 params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
118118 params[key] = params[key].toString();
119119 }});
120120
121- return http.get(path, queryParameters: params, options: options);
121+ return await http.get(path, queryParameters: params, options: options);
122122 } else {
123- return http.request(path, data: params, options: options);
123+ return await http.request(path, data: params, options: options);
124124 }
125125 } on DioError catch(e) {
126+ if(e.response == null) {
127+ throw {{spec .title | caseUcfirst }}AppwriteException(e.message);
128+ }
126129 throw {{spec .title | caseUcfirst }}Exception(e.response.data['message'],e.response.data['code'], e.response.data);
127130 } catch(e) {
128- throw {{spec .title | caseUcfirst }}Exception(e.message, 0 );
131+ throw {{spec .title | caseUcfirst }}Exception(e.message);
129132 }
130133 }
131134}
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ class {{spec.title | caseUcfirst}}Exception implements Exception {
55 final int code;
66 final dynamic response;
77
8- {{spec .title | caseUcfirst }}Exception([this.message = "", this.code = 0 , this.response]);
8+ {{spec .title | caseUcfirst }}Exception([this.message = "", this.code, this.response]);
99
1010}
You can’t perform that action at this time.
0 commit comments