Module Error is not available
Closed this issue · 7 comments
Hi,
I wanted to use this tool. However, I get following error:
$ MIX_ENV=docs mix inch.report
** (UndefinedFunctionError) undefined function: Error.exception/1 (module Error is not available)
Error.exception([message: "module IElixir.HMAC was not compiled with flag --docs"])
lib/inch_ex/docs/retriever.ex:83: InchEx.Docs.Retriever.verify_module/1
lib/inch_ex/docs/retriever.ex:70: InchEx.Docs.Retriever.get_module/2
(elixir) lib/enum.ex:1043: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1385: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:1043: Enum.map/2
lib/inch_ex/docs/retriever.ex:49: InchEx.Docs.Retriever.docs_from_modules/2
lib/inch_ex.ex:39: InchEx.generate_docs/4
23:58:38.860 [error] Error in process <0.47.0> with exit value: {#{'__exception__'=>true,'__struct__'=>'Elixir.UndefinedFunctionError',arity=>1,function=>exception,module=>'Elixir.Error',reason=>nil},[{'Elixir.Error',exception,[[{message,<<53 bytes>>}]],[]},{'Elixir.InchEx.Docs.Retriever',verify_module...
Done. Your build exited with 0.
My first idea was about old OTP version. I tried many different OTPs and problem still occurs. Here's sample build: https://travis-ci.org/pprzetacznik/IElixir/builds/75265410
I test it on feature/inch-ci branch: https://github.com/pprzetacznik/IElixir/tree/feature/inch-ci
Would you mind to take a look at this error and tell me where I should look for the answer?
Hi!
Puh, I honestly have no idea what could cause this error ...
@josevalim could you point us in the right direction what might cause module XY was not compiled with flag --docs
?
First of all, there is no Error module here:
inch_ex/lib/inch_ex/docs/retriever.ex
Line 65 in 967dcea
You probably want to define an alias or do InchCI.Error or whatever it is.
Second, @pprzetacznik are you setting compiler_options somehow? How are you compiling your code? what is your elixir version. Info is appreciated.
@josevalim D'uh! I added the alias and published v0.3.4
of InchEx.
@pprzetacznik When you rerun the test, we should now get the appropriate error message ("module IElixir.HMAC was not compiled with flag --docs").
@rrrene @josevalim I have build it with version v0.3.4 and it's still the same.
This is build: https://travis-ci.org/pprzetacznik/IElixir/builds/75533087 (please note only last command)
1.12s$ MIX_ENV=docs mix inch.report
** (InchEx.Docs.Retriever.Error) module IElixir.HMAC was not compiled with flag --docs
lib/inch_ex/docs/retriever.ex:85: InchEx.Docs.Retriever.verify_module/1
lib/inch_ex/docs/retriever.ex:72: InchEx.Docs.Retriever.get_module/2
(elixir) lib/enum.ex:1043: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1385: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:1043: Enum.map/2
lib/inch_ex/docs/retriever.ex:51: InchEx.Docs.Retriever.docs_from_modules/2
lib/inch_ex.ex:39: InchEx.generate_docs/4
lib/mix/tasks/inch.ex:44: Mix.Tasks.Inch.run/4
00:41:35.306 [error] Process #PID<0.48.0> raised an exception
** (InchEx.Docs.Retriever.Error) module IElixir.HMAC was not compiled with flag --docs
lib/inch_ex/docs/retriever.ex:85: InchEx.Docs.Retriever.verify_module/1
lib/inch_ex/docs/retriever.ex:72: InchEx.Docs.Retriever.get_module/2
(elixir) lib/enum.ex:1043: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1385: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:1043: Enum.map/2
lib/inch_ex/docs/retriever.ex:51: InchEx.Docs.Retriever.docs_from_modules/2
lib/inch_ex.ex:39: InchEx.generate_docs/4
lib/mix/tasks/inch.ex:44: Mix.Tasks.Inch.run/4
This is how I bumped the version: pprzetacznik/IElixir@ec4763d
My .travis file: https://github.com/pprzetacznik/IElixir/blob/ec4763dc4d7c44bf2ecbb8a9c622c91739f94d9c/.travis.yml
My mix.exs file: https://github.com/pprzetacznik/IElixir/blob/ec4763dc4d7c44bf2ecbb8a9c622c91739f94d9c/mix.exs
My mix.lock file: https://github.com/pprzetacznik/IElixir/blob/ec4763dc4d7c44bf2ecbb8a9c622c91739f94d9c/mix.lock
On the other hand when I reduce Elixir version from 1.1-dev to 1.0.5 it works and I get:
$ MIX_ENV=docs mix inch.report
Successfully created build #1
URL: http://inch-ci.org/github/pprzetacznik/IElixir
This is build for:
- OTP 17.5: https://travis-ci.org/pprzetacznik/IElixir/jobs/75533743
- OTP 18.0: https://travis-ci.org/pprzetacznik/IElixir/jobs/75533744
My .travis file: https://github.com/pprzetacznik/IElixir/blob/feature/inch-ci/.travis.yml
My mix.exs file: https://github.com/pprzetacznik/IElixir/blob/feature/inch-ci/mix.exs
My mix.lock file: https://github.com/pprzetacznik/IElixir/blob/feature/inch-ci/mix.lock
This commit: pprzetacznik/IElixir@4248e8d is the only difference.
The bug is here:
inch_ex/lib/inch_ex/docs/retriever.ex
Line 75 in 967dcea
@rrrene, you should not pattern match on the list. Elixir v1.1 adds more items to the returned result and then it breaks your code.
@josevalim Ah, sure!
@pprzetacznik Okay, I made the changes, tested it locally and released v0.4.0-dev
. Can you please test on your end using this version:
{:inch_ex, "0.4.0-dev", only: :docs}
If it succeeds, I will release the "real" v0.4.0
! 👍
@josevalim @rrrene
https://travis-ci.org/pprzetacznik/IElixir/jobs/75671557
It works, thanks!