mafintosh / multicast-dns-service-types

Parse and stringify mdns service types
MIT License
15 stars 4 forks source link

Handeling errors #4

Closed wesleytodd closed 8 years ago

wesleytodd commented 8 years ago

So I was working on some of the changes I mentioned for subtypes, and there are a few error conditions we are not handling. For example:

When using subtypes, the subtype identifier is allowed to be up to 63 bytes, plus the length byte, making 64. Including the "_sub" and its length byte, this makes 69 bytes.

Seems like we should validate these conditions. The question is, do we want to change the api to make the parser look async and return an error or throw errors?

Personally I hate modules that throw, BUT an async looking api seems pretty dumb here. Lastly we could NOT handle the errors and maybe publish a second module which validates multicast dns parts.

watson commented 8 years ago

I don't mind if length restrictions like these are left up to the user. Especially if it's going to complicate the API a lot. There are length restrictions on the DNS records in the Bonjour/Zeroconf protocol as well which I don't enforce. I'd say just ignore it for now and if it becomes a problem then deal with it then. /cc @mafintosh

wesleytodd commented 8 years ago

@watson Im good with that! If you want to check out the changes I made see #6. Closing this.