this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Handle error when deleting labeler declaration

futurGH 461fe7bc 2f63bafa

+20 -12
+19 -11
src/bin.ts
··· 41 41 message: "You will receive a confirmation code via email. Code:", 42 42 }, { onCancel: () => process.exit(1) }); 43 43 44 - try { 45 - if (command === "setup") { 44 + if (command === "setup") { 45 + try { 46 46 const operation = await plcSetupLabeler({ 47 47 did, 48 48 password, ··· 74 74 } 75 75 76 76 console.log("Labeler setup complete!"); 77 - } else { 77 + } catch (error) { 78 + console.error("Error setting up labeler:", error); 79 + } 80 + } else { 81 + try { 78 82 await plcClearLabeler({ did, password, pds, plcToken }); 79 83 await deleteLabelerDeclaration({ identifier: did, password, pds }); 80 84 console.log("Labeler data cleared."); 85 + } catch (error) { 86 + console.error("Error setting up labeler:", error); 81 87 } 82 - } catch (error) { 83 - console.error("Error setting up labeler:", error); 84 88 } 85 89 } else if (command === "label" && (subcommand === "add" || subcommand === "delete")) { 86 90 const { did, password, pds } = await promptAuthInfo(); ··· 122 126 123 127 const definitions = labelDefinitions.filter((def) => !identifiers.includes(def.identifier)); 124 128 125 - if (definitions.length) { 126 - await setLabelerLabelDefinitions({ identifier: did, password, pds }, definitions); 127 - console.log("Deleted label(s):", identifiers.join(", ")); 128 - } else { 129 - await deleteLabelerDeclaration({ identifier: did, password, pds }); 130 - console.log("All labels cleared."); 129 + try { 130 + if (definitions.length) { 131 + await setLabelerLabelDefinitions({ identifier: did, password, pds }, definitions); 132 + console.log("Deleted label(s):", identifiers.join(", ")); 133 + } else { 134 + await deleteLabelerDeclaration({ identifier: did, password, pds }); 135 + console.log("All labels cleared."); 136 + } 137 + } catch (error) { 138 + console.error("Failed to delete labels:", error); 131 139 } 132 140 } 133 141 } else {
+1 -1
src/scripts/declareLabeler.ts
··· 81 81 */ 82 82 export async function deleteLabelerDeclaration(credentials: LoginCredentials): Promise<void> { 83 83 const agent = await loginAgent(credentials); 84 - return agent.app.bsky.labeler.service.delete({ repo: agent.accountDid }).catch(() => {}); 84 + return agent.app.bsky.labeler.service.delete({ repo: agent.accountDid }); 85 85 }