Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
fix(JsonService): throw an ErrorResponse instance for invalid responses
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed Nov 21, 2021
1 parent e819349 commit dff9cdf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/JsonService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

import { ErrorResponse } from "./ErrorResponse";
import { Logger } from "./utils";

/**
Expand Down Expand Up @@ -144,7 +145,7 @@ export class JsonService {
const json = await response.json();
if (json && json.error) {
this._logger.error("postForm: Error from server:", json.error);
throw new Error(json.error);
throw new ErrorResponse(json);
}

return json;
Expand Down

0 comments on commit dff9cdf

Please sign in to comment.