File tree Expand file tree Collapse file tree
src/main/java/engineer/nightowl/sonos/api/resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,9 +142,18 @@ private SonosType getTypeFromHeader(final CloseableHttpResponse response)
142142 final Header header = response .getFirstHeader (SONOS_TYPE_HEADER );
143143 if (header != null && !SonosUtilityHelper .isEmpty (header .getValue ()))
144144 {
145- if (!"none" .equalsIgnoreCase (header .getValue ()))
145+ final String headerValue = header .getValue ();
146+ if (!"none" .equalsIgnoreCase (headerValue ))
146147 {
147- return SonosType .valueOf (header .getValue ());
148+ try
149+ {
150+ return SonosType .valueOf (headerValue );
151+ }
152+ catch (final IllegalArgumentException iae )
153+ {
154+ final String msg = String .format ("Unexpected return type [%s] - please raise a bug" , headerValue );
155+ throw new SonosApiClientException (msg , iae );
156+ }
148157 }
149158 }
150159 }
You can’t perform that action at this time.
0 commit comments