Handle JoinRoom errors, error clases overhaul

This commit is contained in:
miruka
2019-11-09 10:20:16 -04:00
parent dbcca17192
commit e95a23ef90
2 changed files with 47 additions and 7 deletions

View File

@@ -21,13 +21,31 @@ HBox {
let args = [roomField.text]
py.callClientCoro(userId, "room_join", args, roomId => {
button.loading = false
button.loading = false
errorMessage.text = ""
pageLoader.showRoom(userId, roomId)
}, (type, args) => {
button.loading = false
let txt = qsTr("Unknown error - %1, %2").arg(type).arg(args)
if (type === "ValueError")
txt = qsTr("Unrecognized alias, room ID or URL")
if (type === "MatrixNotFound")
txt = qsTr("Room not found")
if (type === "MatrixForbidden")
txt = qsTr("You do not have permission to join this room")
errorMessage.text = txt
})
},
cancel: button => {
roomField.text = ""
roomField.text = ""
errorMessage.text = ""
pageLoader.showPrevious()
}
})