Differentiate between source return types
This commit is contained in:
+10
-5
@@ -783,9 +783,13 @@ contract_code(ID) ->
|
||||
end.
|
||||
|
||||
|
||||
-spec contract_source(ID) -> {ok, Bytecode} | {error, Reason}
|
||||
when ID :: contract_id(),
|
||||
Bytecode :: contract_byte_array(),
|
||||
-spec contract_source(ID) -> Result
|
||||
when ID :: contract_id(),
|
||||
Result :: {ok, Source}
|
||||
| {project, Bundle}
|
||||
| {error, Reason},
|
||||
Source :: string(),
|
||||
Bundle :: [{FilePath :: string(), Contents :: binary()}],
|
||||
Reason :: chain_error() | string().
|
||||
%% @doc
|
||||
%% Retrieve the code of a contract as represented on chain.
|
||||
@@ -805,8 +809,9 @@ extract(Blobby) ->
|
||||
|
||||
extract2(TarBaby) ->
|
||||
case erl_tar:extract({binary, TarBaby}, [memory, compressed]) of
|
||||
{ok, Project} -> {ok, Project};
|
||||
Error ->
|
||||
{ok, Bundle} ->
|
||||
{project, Bundle};
|
||||
Error ->
|
||||
io:format("Dis chit happen: ~tp~n", [Error]),
|
||||
{ok, TarBaby}
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user