Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: When generated TS class name is "Error", it is conflicting with TS Error class #5032

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ let content_ = "";
{%- if parameter.IsRequired -%}
{%- if parameter.IsNullable -%}
if ({{ parameter.VariableName }} === undefined)
throw new Error("The parameter '{{ parameter.VariableName }}' must be defined.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined.");
else
{%- else -%}
if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null)
throw new Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null.");
else
{%- endif -%}
{%- else -%}
{%- if parameter.IsNullable -%}
if ({{ parameter.VariableName }} !== undefined)
{%- else -%}
if ({{ parameter.VariableName }} === null)
throw new Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
else if ({{ parameter.VariableName }} !== undefined)
{%- endif -%}
{%- endif -%}
Expand Down Expand Up @@ -48,7 +48,7 @@ const content_ = new FormData();
if ({{ parameter.VariableName }} !== null && {{ parameter.VariableName }} !== undefined)
{%- else -%}
if ({{ parameter.VariableName }} === null || {{ parameter.VariableName }} === undefined)
throw new Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
else
{%- endif -%}
{%- if parameter.IsFile -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% for parameter in operation.PathParameters -%}
{% if parameter.IsRequired -%}
if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null)
throw new Error("The parameter '{{ parameter.VariableName }}' must be defined.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined.");
{% else -%}
if ({{ parameter.VariableName }} !== null && {{ parameter.VariableName }} !== undefined)
{% endif -%}
Expand All @@ -24,19 +24,19 @@ else
{% if parameter.IsRequired -%}
{% if parameter.IsNullable -%}
if ({{ parameter.VariableName }} === undefined)
throw new Error("The parameter '{{ parameter.VariableName }}' must be defined.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined.");
else if({{ parameter.VariableName }} !== null)
{% else -%}
if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null)
throw new Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null.");
else
{% endif -%}
{% else -%}
{% if parameter.IsNullable -%}
if ({{ parameter.VariableName }} !== undefined && {{ parameter.VariableName }} !== null)
{% else -%}
if ({{ parameter.VariableName }} === null)
throw new Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
else if ({{ parameter.VariableName }} !== undefined)
{% endif -%}
{% endif -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export class Client {
calculateSum(a: number, b: number): Promise<number> {
let url_ = this.baseUrl + "/sum/{a}/{b}";
if (a === undefined || a === null)
throw new Error("The parameter 'a' must be defined.");
throw new globalThis.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
if (b === undefined || b === null)
throw new Error("The parameter 'b' must be defined.");
throw new globalThis.Error("The parameter 'b' must be defined.");
url_ = url_.replace("{b}", encodeURIComponent("" + b));
url_ = url_.replace(/[?&]$/, "");

Expand Down Expand Up @@ -97,7 +97,7 @@ export class Client {
absoluteValue(a: number): Promise<number> {
let url_ = this.baseUrl + "/abs({a})";
if (a === undefined || a === null)
throw new Error("The parameter 'a' must be defined.");
throw new globalThis.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
url_ = url_.replace(/[?&]$/, "");

Expand Down Expand Up @@ -135,7 +135,7 @@ export class Client {
identity(id: number): Promise<number> {
let url_ = this.baseUrl + "/id:{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
throw new globalThis.Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export class Client {
calculateSum(a: number, b: number): Promise<number> {
let url_ = this.baseUrl + "/sum/{a}/{b}";
if (a === undefined || a === null)
throw new Error("The parameter 'a' must be defined.");
throw new globalThis.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
if (b === undefined || b === null)
throw new Error("The parameter 'b' must be defined.");
throw new globalThis.Error("The parameter 'b' must be defined.");
url_ = url_.replace("{b}", encodeURIComponent("" + b));
url_ = url_.replace(/[?&]$/, "");

Expand Down Expand Up @@ -97,7 +97,7 @@ export class Client {
absoluteValue(a: number): Promise<number> {
let url_ = this.baseUrl + "/abs({a})";
if (a === undefined || a === null)
throw new Error("The parameter 'a' must be defined.");
throw new globalThis.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
url_ = url_.replace(/[?&]$/, "");

Expand Down Expand Up @@ -135,7 +135,7 @@ export class Client {
identity(id: number): Promise<number> {
let url_ = this.baseUrl + "/id:{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
throw new globalThis.Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export class Client {
calculateSum(a: number, b: number): Promise<number> {
let url_ = this.baseUrl + "/sum/{a}/{b}";
if (a === undefined || a === null)
throw new Error("The parameter 'a' must be defined.");
throw new globalThis.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
if (b === undefined || b === null)
throw new Error("The parameter 'b' must be defined.");
throw new globalThis.Error("The parameter 'b' must be defined.");
url_ = url_.replace("{b}", encodeURIComponent("" + b));
url_ = url_.replace(/[?&]$/, "");

Expand Down Expand Up @@ -97,7 +97,7 @@ export class Client {
absoluteValue(a: number): Promise<number> {
let url_ = this.baseUrl + "/abs({a})";
if (a === undefined || a === null)
throw new Error("The parameter 'a' must be defined.");
throw new globalThis.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
url_ = url_.replace(/[?&]$/, "");

Expand Down Expand Up @@ -135,7 +135,7 @@ export class Client {
identity(id: number): Promise<number> {
let url_ = this.baseUrl + "/id:{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
throw new globalThis.Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");

Expand Down
Loading