You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@plc4x.apache.org by "chrisdutz (via GitHub)" <gi...@apache.org> on 2025/12/04 10:20:58 UTC

Re: [I] [Feature Request]: better error message when data-content doesn't mach data-spec in S7

chrisdutz commented on issue #2377:
URL: https://github.com/apache/plc4x/issues/2377#issuecomment-3611342706

   Well ... I think we really should remove the option to pass in raw values to write operations. The ideal way would be to pass in a PlcValue. This would have fired an error the moment you tried to create it. The other way just contains way too much potential for things going wrong.
   
   ```
           PlcValue val = new PlcINT(0x8000);
           System.out.println(val);
   ```
   
   This results in:
   
   ```
   org.apache.plc4x.java.api.exceptions.PlcInvalidTagException: Value of type 32768 is out of range -32768 - 32767 for a PlcINT Value invalid
   
   	at com.toddysoft.connect.java.spi.values.PlcINT.<init>(PlcINT.java:87)
   	at com.toddysoft.connect.java.s7.tags.S7TagTest.testDataBlockShortPattern_NonBoolTypeWithBitOffset_ShouldError(S7TagTest.java:526)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
   
   ```
   (Ignore the different package ... I just tested that in my commercial offering)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org