1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| import { __awaiter, __generator } from "tslib";
| import { env } from '../env';
| export function fetchOrThrow(url, init) {
| return __awaiter(this, void 0, void 0, function () {
| var fetch, res;
| return __generator(this, function (_a) {
| switch (_a.label) {
| case 0:
| fetch = env.getEnv().fetch;
| return [4 /*yield*/, fetch(url, init)];
| case 1:
| res = _a.sent();
| if (!(res.status < 400)) {
| throw new Error("failed to fetch: (" + res.status + ") " + res.statusText + ", from url: " + res.url);
| }
| return [2 /*return*/, res];
| }
| });
| });
| }
| //# sourceMappingURL=fetchOrThrow.js.map
|
|