Modified Javascript Client generator to throw the response instead of a message so that behavior of the code using the Client can changed based on the response returned. Bumped package version to 1.7.2
This commit is contained in:
parent
2f71c18b65
commit
4c64f1c134
@ -17,7 +17,7 @@
|
||||
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
||||
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Version>1.7.1</Version>
|
||||
<Version>1.7.2</Version>
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
@ -502,6 +502,8 @@ namespace MontoyaTech.Rest.Net
|
||||
if (routeResponse != null)
|
||||
writer.WriteLine($"@returns {{{this.GetTypeFullyResolvedName(routeResponse.ResponseType)}}}");
|
||||
|
||||
writer.WriteLine("@throws {Response} If response status was not ok.");
|
||||
|
||||
writer.Outdent().WriteLine("*/");
|
||||
|
||||
//Generate the route function header
|
||||
@ -666,13 +668,13 @@ namespace MontoyaTech.Rest.Net
|
||||
}
|
||||
|
||||
writer.Outdent().WriteLine("} else {").Indent();
|
||||
writer.WriteLine("throw `Unexpected http response status: ${response.status}`;");
|
||||
writer.WriteLine("throw response;");
|
||||
writer.Outdent().WriteLine("}");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteBreak().WriteLine("if (!response.ok) {").Indent();
|
||||
writer.WriteLine("throw `Unexpected http response status: ${response.status}`;");
|
||||
writer.WriteLine("throw response;");
|
||||
writer.Outdent().WriteLine("}");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user