aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2021-08-23 22:04:03 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2021-08-23 22:04:03 +0200
commitebf03a3745ac4ba2089adc1ef872adfcfc081d56 (patch)
treee71358f6ad7285bb37dc0c8b7c8b4d23c477f02d
parentnode_flat_sql: Avoid catch-all clauses for RSM (diff)
node_flat: Avoid catch-all clauses for RSM
Apply the change made in the previous commit to Mnesia storage as well.
-rw-r--r--src/node_flat.erl11
1 files 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};