The thing is however, that S7 for example has “NOT FOUND” if an address could 
not be found. And that actually represents the reality a lot better .. because 
the addresss is actually valid, just not on that device.

Chris

Von: Jinlin Hong <myhongjin...@gmail.com>
Datum: Montag, 23. September 2024 um 09:59
An: dev@plc4x.apache.org <dev@plc4x.apache.org>
Betreff: Re: [DISCUSS] Which return code to give for items that don't exist?
Hi Chris,


I think it makes sense to keep INVALID_ADDRESS consistent with the PLC
logic, meaning it would represent the case when a resource can’t be found.
Then we could use something like ERROR_ADDRESS_FORMAT to indicate a syntax
error. I just checked plc4go and saw errors.Errorf("Invalid address format
for address '%s'", tagAddress) being used. Looking forward to hearing
thoughts from the rest of the team.


Jinlin Hong

Christofer Dutz <christofer.d...@c-ware.de> 於 2024年9月23日 週一 下午3:22寫道:

> While working on this I noticed, we need to update the ReadRequest a bit …
> When we call “build” on the ReadRequest builder and that passes all
> address strings to the tag-handler. If there’s only one invalid address,
> the entire build() call fails.
>
> I think we need to add a:
>
> PlcResponseCode getTagResponseCode(String tagName);
>
> To check if a tag in the ReadRequest was OK, if it’s not to simply relay
> that to the result.
>
> Or what do you think would be a better solution?
>
> Chris
>
> Von: Lukas Ott <ott.lukas...@gmail.com>
> Datum: Sonntag, 22. September 2024 um 15:30
> An: dev@plc4x.apache.org <dev@plc4x.apache.org>
> Betreff: Re: [DISCUSS] Which return code to give for items that don't
> exist?
> +1 for "return INVALID_ADDRESS if the address is syntactically invalid and
> NOT_FOUND, if the address is formally correct, but the resource could not
> be found." sounds logical and understandable to me.
>
> Luk
>
> Christofer Dutz <christofer.d...@c-ware.de> schrieb am So., 22. Sept.
> 2024,
> 14:38:
>
> > Hi all,
> >
> > I have been working a bit on streamlining the return results from our
> > drivers to be a bit more consistent.
> > Now I noticed that there is quite a huge difference between
> > INVALID_ADDRESS and NOT_FOUND.
> >
> > Most drivers return an INVALID_ADDRESS if for example a symbolic address
> > is used, and this does not exist on the PLC.
> > However the address IS valid, it’s just that the PLC can’t find a
> resource
> > with that given name. Similar with S7, if I specify a block number that
> > does not exist or a byte offset that exceeds the size of the block.
> >
> > I think we should probably return INVALID_ADDRESS if the address is
> > syntactically invalid and NOT_FOUND, if the address is formally correct,
> > but the resource could not be found.
> >
> > What do you think?
> >
> > Chris
> >
> >
> >
>

Reply via email to