Skip to content

Commit 61f7e5a

Browse files
remove redundant catch block
1 parent 3bc9140 commit 61f7e5a

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

packages/core/src/lib/metadata/index.ts

+13-18
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,17 @@ class Metadata extends BaseProtocol {
4040
async (source) => await all(source)
4141
);
4242

43-
try {
44-
const bytes = new Uint8ArrayList();
45-
res.forEach((chunk) => {
46-
bytes.append(chunk);
47-
});
43+
const bytes = new Uint8ArrayList();
44+
res.forEach((chunk) => {
45+
bytes.append(chunk);
46+
});
4847

49-
const shardInfoRes = proto_metadata.WakuMetadataResponse.decode(bytes);
50-
if (!shardInfoRes) {
51-
throw new Error("WakuMetadata response is undefined");
52-
}
53-
if (!shardInfoRes.clusterId) {
54-
throw new Error("WakuMetadata response clusterId is undefined");
55-
}
56-
} catch (e) {
57-
log.error(`Error decoding response: ${e}`);
58-
throw e;
48+
const shardInfoRes = proto_metadata.WakuMetadataResponse.decode(bytes);
49+
if (!shardInfoRes) {
50+
throw new Error("WakuMetadata response is undefined");
51+
}
52+
if (!shardInfoRes.clusterId) {
53+
throw new Error("WakuMetadata response clusterId is undefined");
5954
}
6055
}
6156

@@ -88,9 +83,9 @@ class Metadata extends BaseProtocol {
8883
}
8984

9085
return response as ShardInfo;
91-
} catch (err) {
92-
log.error("Error decoding metadata response", err);
93-
throw err;
86+
} catch (error) {
87+
log.error("Error decoding metadata response", error);
88+
throw error;
9489
}
9590
}
9691
}

0 commit comments

Comments
 (0)