Skip to content

Commit b01c274

Browse files
authored
added missing logs (#22)
Added logs that were removed during #20 This logs are necessary because, if the action is failing with a specific user, having their address can be very helpful at debugging.
1 parent a5b239d commit b01c274

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/fellows.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,40 @@ export const fetchAllFellows = async (
4343
const getGhHandle = async (
4444
address: SS58String,
4545
): Promise<string | undefined> => {
46+
logger.debug(`Fetching identity of '${address}'`);
4647
const identity =
4748
await relayApi.query.Identity.IdentityOf.getValue(address);
4849

49-
if (identity)
50-
return identity.info.additional
50+
if (identity) {
51+
const handle = identity.info.additional
5152
.find(([key]) => key.value?.asText() === "github")?.[1]
5253
.value?.asText()
5354
.replace("@", "");
55+
if (handle) {
56+
logger.info(`Found github handle for '${address}': '${handle}'`);
57+
} else {
58+
logger.debug(`'${address}' does not have a GitHub handle`);
59+
}
60+
return handle;
61+
}
62+
63+
logger.debug(
64+
`Identity of '${address}' is null. Checking for super identity`,
65+
);
5466

5567
const superIdentityAddress = (
5668
await relayApi.query.Identity.SuperOf.getValue(address)
5769
)?.[0];
58-
return await (superIdentityAddress && getGhHandle(superIdentityAddress));
70+
71+
if (superIdentityAddress) {
72+
logger.debug(
73+
`'${address}' has a super identity: '${superIdentityAddress}'. Fetching that identity`,
74+
);
75+
return await getGhHandle(superIdentityAddress);
76+
} else {
77+
logger.debug(`No superidentity for ${address} found.`);
78+
return undefined;
79+
}
5980
};
6081

6182
logger.info("Initializing the collectives client");

0 commit comments

Comments
 (0)