From ebf03a3745ac4ba2089adc1ef872adfcfc081d56 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 23 Aug 2021 22:04:03 +0200 Subject: [PATCH] node_flat: Avoid catch-all clauses for RSM Apply the change made in the previous commit to Mnesia storage as well. --- src/node_flat.erl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/node_flat.erl b/src/node_flat.erl index 97f149f9c..c597b9ce9 100644 --- a/src/node_flat.erl +++ b/src/node_flat.erl @@ -957,15 +957,12 @@ rsm_page(Count, Index, Offset, Items) -> last = Last}. encode_stamp(Stamp) -> - case catch xmpp_util:decode_timestamp(Stamp) of - {MS,S,US} -> {MS,S,US}; - _ -> Stamp + try xmpp_util:decode_timestamp(Stamp) + catch _:{bad_timestamp, _} -> + Stamp % We should return a proper error to the client instead. end. decode_stamp(Stamp) -> - case catch xmpp_util:encode_timestamp(Stamp) of - TimeStamp when is_binary(TimeStamp) -> TimeStamp; - _ -> Stamp - end. + xmpp_util:encode_timestamp(Stamp). transform({pubsub_state, {Id, Nidx}, Is, A, Ss}) -> {pubsub_state, {Id, Nidx}, Nidx, Is, A, Ss};