Skip to content

Commit 2aaf5d8

Browse files
committed
Better error message
1 parent 2711b47 commit 2aaf5d8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

templates/web/src/sdk.ts.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,11 @@ class {{ spec.title | caseUcfirst }} {
514514
{% if 'multipart/form-data' in method.consumes %}
515515
{% for parameter in method.parameters.all %}
516516
{% if parameter.type == 'file' %}
517+
518+
if(!({{ parameter.name | caseCamel | escapeKeyword }} instanceof File)) {
519+
throw new {{spec.title | caseUcfirst}}Exception('Parameter "{{ parameter.name | caseCamel | escapeKeyword }}" has to be a File.');
520+
}
521+
517522
const size = {{ parameter.name | caseCamel | escapeKeyword }}.size;
518523

519524
if (size <= {{ spec.title | caseUcfirst }}.CHUNK_SIZE) {

0 commit comments

Comments
 (0)