Skip to content

Commit

Permalink
Ensure jobpack:valid catches all errors, so that subsequent metadata …
Browse files Browse the repository at this point in the history
…ops cannot error out.
  • Loading branch information
pmundkur authored and srobertson committed Oct 7, 2012
1 parent 6126764 commit b5c7a64
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions master/src/jobpack.erl
Expand Up @@ -98,11 +98,14 @@ valid(<<?MAGIC:16/big,
JobHomeOffset >= JobEnvsOffset,
JobDataOffset >= JobHomeOffset,
byte_size(JobPack) >= JobDataOffset ->
try _ = jobenvs(JobPack),
try _ = jobinfo(JobPack),
_ = jobenvs(JobPack),
ok
catch _:_ -> {error, invalid_dicts_or_envs}
catch
{error, E} -> E;
_:_ -> {error, "invalid payload"}
end;
valid(_JobPack) -> {error, invalid_header}.
valid(_JobPack) -> {error, "invalid header"}.

-spec validate_prefix(binary() | list()) -> nonempty_string().
validate_prefix(Prefix) when is_binary(Prefix)->
Expand Down

0 comments on commit b5c7a64

Please sign in to comment.