TeamNewPipe / NewPipeExtractor

NewPipe's core library for extracting data from streaming sites
GNU General Public License v3.0
1.4k stars 421 forks source link

LocaleCompat.forLanguageTag: return Optional if parsing fails #1151

Closed Profpatsch closed 8 months ago

Profpatsch commented 10 months ago

It’s not obvious that the function will fail in some cases and throw an IllegalArgumentException.

So instead of just failing if parsing fails, return an Optional that all callers have to decide what to do (e.g. the YoutubeExtractor can just ignore the locale in that case, like it does with most other fields in the json if they are unexpected).