Skip to content

Commit

Permalink
fix: tests for web, add response in just text errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragAgg5k committed Jan 29, 2025
1 parent ba3a9ad commit 256f74c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class Client @JvmOverloads constructor(
body
)
} else {
{{ spec.title | caseUcfirst }}Exception(body, response.code)
{{ spec.title | caseUcfirst }}Exception(body, response.code, '', body)
}
it.cancel(error)
return
Expand Down
2 changes: 1 addition & 1 deletion templates/dart/lib/src/client_mixin.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ClientMixin {
res.body,
);
} else {
throw {{spec.title | caseUcfirst}}Exception(res.body);
throw {{spec.title | caseUcfirst}}Exception(res.body, res.statusCode, '', res.body);
}
}
dynamic data;
Expand Down
2 changes: 1 addition & 1 deletion templates/flutter/lib/src/client_mixin.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ClientMixin {
res.body,
);
} else {
throw {{spec.title | caseUcfirst}}Exception(res.body);
throw {{spec.title | caseUcfirst}}Exception(res.body, res.statusCode, '', res.body);
}
}
dynamic data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class Client @JvmOverloads constructor(
body
)
} else {
{{ spec.title | caseUcfirst }}Exception(body, response.code)
{{ spec.title | caseUcfirst }}Exception(body, response.code, '', body)
}
it.cancel(error)
return
Expand Down
3 changes: 3 additions & 0 deletions tests/languages/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,21 @@
response = await general.error400();
} catch (error) {
console.log(error.message);
console.log(error.response);
}

try {
response = await general.error500();
} catch (error) {
console.log(error.message);
console.log(error.response);
}

try {
response = await general.error502();
} catch (error) {
console.log(error.message);
console.log(error.response);
}

const delay = ms => new Promise(res => setTimeout(res, ms));
Expand Down

0 comments on commit 256f74c

Please sign in to comment.