<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 26, 2012, at 1:43 PM, Laurens Van Houtven &lt;_@lvh.cc&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Menlo; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>I'm writing a custom AMP type. I noticed that when writing the unit test for garbage input, I didn't really know what exception to check for.</div><br></div><span style="font-family: Menlo; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">I couldn't find any place where this was formally defined, so I checked for implementation behavior. Boolean explicitly raises TypeError. Integer raises ValueError, but that appears to only be an implementation detail of int.</span><br style="font-family: Menlo; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br style="font-family: Menlo; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span style="font-family: Menlo; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">It could also be that it doesn't matter at all, but it does seem a little strange that Integer and Boolean raise different exceptions when fed garbage...</span></blockquote><br></div><div>Hey Laurens,</div><div><br></div><div>This is basically a feature request :). &nbsp;There's no particular defined error type for argument parse errors in AMP. &nbsp;It's not a bad feature though. &nbsp;The exception also doesn't go anywhere useful - the only contract is basically that it'll bubble up and break the connection if you get some bad data. &nbsp;A more sophisticated and trappable / trackable way to propagate this sort of error would be useful.</div><div><br></div><div>(I would personally consider it a compatible change if the behavior of the error cases changed here, on the grounds that anything that uncontrollably logs a traceback in response to network input is a gross spec violation of a sort. &nbsp;Maybe we should add an explicit exemption for that case.)</div><div><br></div><div>-glyph</div></body></html>