From 091bb38286841745c2f9a40d2dbe654546c99a8f Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 3 Nov 2017 07:17:00 +0100 Subject: [PATCH] Make error reporting around _g_enum_nick_to_value() more consistent --- src/matrix-event-call-answer.vala | 7 +++++-- src/matrix-event-call-invite.vala | 7 +++++-- src/matrix-event-room-guest-access.vala | 6 ++++-- src/matrix-event-room-history-visibility.vala | 4 ++++ src/matrix-event-room-join-rules.vala | 6 ++++-- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/matrix-event-call-answer.vala b/src/matrix-event-call-answer.vala index a6bd5c9..cdfc63b 100644 --- a/src/matrix-event-call-answer.vala +++ b/src/matrix-event-call-answer.vala @@ -49,8 +49,11 @@ public class Matrix.Event.CallAnswer : Matrix.Event.Call { _answer_type = typ; } else { _answer_type = CallAnswerType.UNKNOWN; - warning("Unknown value %s for content.answer.type in a m.call.answer event", - node.get_string()); + + if (Config.DEBUG) { + warning("Unknown value %s for content.answer.type in a m.call.answer event", + node.get_string()); + } } } else { warning("content.answer.type is missing from a m.call.answer event"); diff --git a/src/matrix-event-call-invite.vala b/src/matrix-event-call-invite.vala index b6b3603..179c44b 100644 --- a/src/matrix-event-call-invite.vala +++ b/src/matrix-event-call-invite.vala @@ -57,8 +57,11 @@ public class Matrix.Event.CallInvite : Matrix.Event.Call { _offer_type = typ; } else { _offer_type = CallOfferType.UNKNOWN; - warning("Unknown value %s in content.offer.type of a m.call.invite event", - node.get_string()); + + if (Config.DEBUG) { + warning("Unknown value %s in content.offer.type of a m.call.invite event", + node.get_string()); + } } } else { warning("content.offer.type is missing from a m.call.invite event"); diff --git a/src/matrix-event-room-guest-access.vala b/src/matrix-event-room-guest-access.vala index dc0af25..ff86c02 100644 --- a/src/matrix-event-room-guest-access.vala +++ b/src/matrix-event-room-guest-access.vala @@ -56,8 +56,10 @@ public class Matrix.Event.RoomGuestAccess : Matrix.Event.State { } else { _guest_access = GuestAccess.UNKNOWN; - warning("Unknown value '%s' in a m.room.guest_access event", - node.get_string()); + if (Config.DEBUG) { + warning("Unknown value '%s' in a m.room.guest_access event", + node.get_string()); + } } } else { warning("content.guest_access is missing from a m.room.guest_access event"); diff --git a/src/matrix-event-room-history-visibility.vala b/src/matrix-event-room-history-visibility.vala index 73ad644..2f2f5d0 100644 --- a/src/matrix-event-room-history-visibility.vala +++ b/src/matrix-event-room-history-visibility.vala @@ -55,6 +55,10 @@ public class Matrix.Event.RoomHistoryVisibility : Matrix.Event.State { _visibility = vis; } else { _visibility = Matrix.HistoryVisibility.UNKNOWN; + + if (Config.DEBUG) { + warning("Unknown history_visibility value %s", node.get_string()); + } } } diff --git a/src/matrix-event-room-join-rules.vala b/src/matrix-event-room-join-rules.vala index 8212b5d..eb45eb0 100644 --- a/src/matrix-event-room-join-rules.vala +++ b/src/matrix-event-room-join-rules.vala @@ -51,8 +51,10 @@ public class Matrix.Event.RoomJoinRules : Matrix.Event.State { } else { _join_rules = Matrix.JoinRules.UNKNOWN; - warning("Unknown value %s in a m.room.join_rules event", - node.get_string()); + if (Config.DEBUG) { + warning("Unknown value %s in a m.room.join_rules event", + node.get_string()); + } } } else { _join_rules = Matrix.JoinRules.UNKNOWN;