Skip to content

Commit 482b64d

Browse files
authored
Merge pull request #356 from semaphore-protocol/ref/improve-error-messages
Improve error messages Former-commit-id: e1f66a7
2 parents 5d2e1ca + 7163e6f commit 482b64d

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

packages/cli/src/index.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ program
132132

133133
const groupIds = await getGroupIds(network)
134134

135-
if (groupIds === null) return
135+
if (groupIds === null) {
136+
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
137+
return
138+
}
136139

137140
const content = `${chalk.bold("Groups")} (${groupIds.length}): \n${groupIds
138141
.map((id: any) => ` - ${id}`)
@@ -160,7 +163,10 @@ program
160163
if (!groupId) {
161164
const groupIds = await getGroupIds(network)
162165

163-
if (groupIds === null) return
166+
if (groupIds === null) {
167+
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
168+
return
169+
}
164170

165171
groupId = await getGroupId(groupIds)
166172
}
@@ -193,6 +199,11 @@ program
193199
}
194200
}
195201

202+
if (!group) {
203+
console.info(`\n ${logSymbols.error}`, "error: the group does not exist\n")
204+
return
205+
}
206+
196207
let content = ` ${chalk.bold("Id")}: ${group.id}\n`
197208
content += ` ${chalk.bold("Admin")}: ${group.admin}\n`
198209
content += ` ${chalk.bold("Merkle tree")}:\n`
@@ -223,7 +234,10 @@ program
223234
if (!groupId) {
224235
const groupIds = await getGroupIds(network)
225236

226-
if (groupIds === null) return
237+
if (groupIds === null) {
238+
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
239+
return
240+
}
227241

228242
groupId = await getGroupId(groupIds)
229243
}
@@ -286,7 +300,10 @@ program
286300
if (!groupId) {
287301
const groupIds = await getGroupIds(network)
288302

289-
if (groupIds === null) return
303+
if (groupIds === null) {
304+
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
305+
return
306+
}
290307

291308
groupId = await getGroupId(groupIds)
292309
}

0 commit comments

Comments
 (0)