Handle non-existent channel
This commit is contained in:
parent
80749b8827
commit
dbc512237a
@ -148,16 +148,22 @@ func UpdatePanel(ctx *gin.Context) {
|
||||
newMessageId, err = messageData.send(&botContext)
|
||||
if err != nil {
|
||||
var unwrapped request.RestError
|
||||
if errors.As(err, &unwrapped) && unwrapped.StatusCode == 403 {
|
||||
ctx.JSON(500, utils.ErrorStr("I do not have permission to send messages in the specified channel"))
|
||||
if errors.As(err, &unwrapped) {
|
||||
if unwrapped.StatusCode == 403 {
|
||||
ctx.JSON(403, utils.ErrorStr("I do not have permission to send messages in the specified channel"))
|
||||
return
|
||||
} else if unwrapped.StatusCode == 404 {
|
||||
// Swallow error
|
||||
// TODO: Make channel_id column nullable, and set to null
|
||||
} else {
|
||||
// TODO: Most appropriate error?
|
||||
ctx.JSON(500, utils.ErrorJson(err))
|
||||
}
|
||||
|
||||
} else {
|
||||
ctx.JSON(500, utils.ErrorJson(err))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update welcome message
|
||||
var welcomeMessageEmbed *int
|
||||
|
Loading…
x
Reference in New Issue
Block a user