<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I'm wondering if there is a simple process I can use to verify a map only contains valid variables. Consider the following example:</p>
<p><br>
</p>
<p></p>
<div>2> Checkmaps = fun(M) -></div>
<div>2> #{"one" := One, "two" := _Two} = M,</div>
<div>2> One end.</div>
<div>#Fun<erl_eval.6.99386804></div>
<div><br>
</div>
% These crash as expected
<p></p>
<p></p>
<div>5> Checkmaps(#{"test" => one }).</div>
<div>** exception error: no match of right hand side value #{"test" => one}</div>
<div>
<div>6> Checkmaps(#{"one" => one }).</div>
<div>** exception error: no match of right hand side value #{"one" => one}</div>
<div><br>
</div>
<br>
</div>
% This works as expected
<p></p>
<p></p>
<div>7> Checkmaps(#{"one" => one, "two" => two }).</div>
<div>one</div>
<div><br>
</div>
% This however also runs - I would like it to crash like the first example
<p></p>
<p><span style="font-size: 12pt;">8> Checkmaps(#{"one" => one, "two" => two, "three" => test }).</span><br>
</p>
<p></p>
<div>one</div>
<div><br>
</div>
<p></p>
<p>The use case here is I'm pulling external data - anything I'm not expecting is not a happy path. Any assistance appreciated.</p>
</div>
</body>
</html>