history: warn on error

master
Nicolò Balzarotti 2018-09-18 08:52:00 +02:00
parent 63a896fcc3
commit e2f0ad09da
1 changed files with 13 additions and 3 deletions

View File

@ -60,7 +60,17 @@ end
function history(u::MatrixUser, room_id::String; limit = 15)
res = roomhistory(u, room_id, limit = limit)
map(x -> println(MatrixMsg(x["sender"], x["origin_server_ts"],
x["content"]["msgtype"], x["content"]["body"],
)), res["chunk"])
map(x -> try
println(MatrixMsg(x["sender"], x["origin_server_ts"],
x["content"]["msgtype"], x["content"]["body"],
))
catch e
if isa(e, KeyError)
@warn "Improve me! Key not found:"
@show x
else
throw(e)
end
end
, res["chunk"])
end