Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

make joxa throw a useful error on invalid patterns

  • Loading branch information...
commit 85d82d9ff84d612d10f930294cde76e98ba16b2a 1 parent fc09828
Eric Merritt ericbmerritt authored

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. +6 2 src/jxa_clause.erl
8 src/jxa_clause.erl
@@ -124,8 +124,12 @@ comp_pattern(Path0, Acc0, [list | Args]) ->
124 124 mk_list(Path1, Acc0, Args);
125 125 comp_pattern(Path0, Acc0, [tuple | Args]) ->
126 126 mk_tuple(Path0, Acc0, Args);
127   -comp_pattern(Path0, Ctx0, Arg) when is_tuple(Arg) ->
128   - mk_tuple(Path0, Ctx0, tuple_to_list(Arg)).
  127 +comp_pattern(Path0, Acc0, Arg) when is_tuple(Arg) ->
  128 + mk_tuple(Path0, Acc0, tuple_to_list(Arg));
  129 +comp_pattern(Path0, {Ctx0, _}, _Arg) ->
  130 + Idx = jxa_annot:get_idx(jxa_path:path(Path0),
  131 + jxa_ctx:annots(Ctx0)),
  132 + ?JXA_THROW({invalid_pattern, Idx}).
129 133
130 134 mk_guards(GuardAnnots, []) ->
131 135 cerl:ann_c_atom(GuardAnnots, true);

0 comments on commit 85d82d9

Please sign in to comment.
Something went wrong with that request. Please try again.