@@ -867,22 +867,37 @@ void ChargePoint::message_callback(const std::string& message) {
867
867
}
868
868
} catch (const EvseOutOfRangeException& e) {
869
869
EVLOG_error << " Exception during handling of message: " << e.what ();
870
+ if (enhanced_message.messageTypeId != MessageTypeId::CALL) {
871
+ return ; // CALLERROR shall only follow on a CALL message
872
+ }
870
873
auto call_error = CallError (enhanced_message.uniqueId , " OccurrenceConstraintViolation" , e.what (), json ({}));
871
874
this ->message_dispatcher ->dispatch_call_error (call_error);
872
875
} catch (const ConnectorOutOfRangeException& e) {
873
876
EVLOG_error << " Exception during handling of message: " << e.what ();
877
+ if (enhanced_message.messageTypeId != MessageTypeId::CALL) {
878
+ return ; // CALLERROR shall only follow on a CALL message
879
+ }
874
880
auto call_error = CallError (enhanced_message.uniqueId , " OccurrenceConstraintViolation" , e.what (), json ({}));
875
881
this ->message_dispatcher ->dispatch_call_error (call_error);
876
882
} catch (const EnumConversionException& e) {
877
883
EVLOG_error << " EnumConversionException during handling of message: " << e.what ();
884
+ if (enhanced_message.messageTypeId != MessageTypeId::CALL) {
885
+ return ; // CALLERROR shall only follow on a CALL message
886
+ }
878
887
auto call_error = CallError (enhanced_message.uniqueId , " FormationViolation" , e.what (), json ({}));
879
888
this ->message_dispatcher ->dispatch_call_error (call_error);
880
889
} catch (const TimePointParseException& e) {
881
890
EVLOG_error << " Exception during handling of message: " << e.what ();
891
+ if (enhanced_message.messageTypeId != MessageTypeId::CALL) {
892
+ return ; // CALLERROR shall only follow on a CALL message
893
+ }
882
894
auto call_error = CallError (enhanced_message.uniqueId , " FormationViolation" , e.what (), json ({}));
883
895
this ->message_dispatcher ->dispatch_call_error (call_error);
884
896
} catch (json::exception & e) {
885
897
EVLOG_error << " JSON exception during handling of message: " << e.what ();
898
+ if (enhanced_message.messageTypeId != MessageTypeId::CALL) {
899
+ return ; // CALLERROR shall only follow on a CALL message
900
+ }
886
901
if (json_message.is_array () and json_message.size () > MESSAGE_ID) {
887
902
auto call_error = CallError (enhanced_message.uniqueId , " FormationViolation" , e.what (), json ({}));
888
903
this ->message_dispatcher ->dispatch_call_error (call_error);
0 commit comments