Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psc-docs is using Show instance for errors #1681

Closed
hdgarrood opened this issue Nov 29, 2015 · 5 comments
Closed

psc-docs is using Show instance for errors #1681

hdgarrood opened this issue Nov 29, 2015 · 5 comments

Comments

@hdgarrood
Copy link
Contributor

For example, on current slamdata master (I guess they're using an older compiler?)

$ pulp docs
* Generating documentation in /home/harry/documents/code/slamdata
psc-docs: error: unknown module "ModuleName [ProperName {runProperName = "View"},ProperName {runProperName = "File"},ProperName {runProperName = "Modal"},ProperName {runProperName = "Mount"}]"
* ERROR: Subcommand terminated with error code 1
@garyb
Copy link
Member

garyb commented Nov 29, 2015

I guess they're using an older compiler?

Yeah, master is stuck on psc 0.7.2. Main development is in the new-halogen branch currently.

@paf31
Copy link
Contributor

paf31 commented Nov 30, 2015

So is this a bug in master?

@paf31 paf31 added this to the 0.9.0 milestone Nov 30, 2015
@hdgarrood
Copy link
Contributor Author

Sorry, yes, my point was that it would probably be better for psc-docs to not use the Show ModuleName instance when reporting errors.

@hdgarrood
Copy link
Contributor Author

I can't reproduce this now. Maybe it's been fixed, somehow.

I think the problem must have been somewhere inside Language.PureScript (i.e. the library) rather than inside the code specific psc-docs, given that the "unknown module" part is displayed in a human-friendly way, it's just the actual module name that's using Show.

If I try to run pulp docs without first running bower install, in order to purposefully trigger an unknown module error, I do now get a properly formatted error:

Error found:
at /home/harry/documents/code/slamdata/src/View/Modal/Common.purs line 21, column 1 - line 23, column 1

  Unknown module Control.Plus


See https://github.com/purescript/purescript/wiki/Error-Code-UnknownModule for more information,
or to contribute content related to this error.

So I'm going to close this.

@hdgarrood hdgarrood reopened this Dec 27, 2015
@hdgarrood
Copy link
Contributor Author

Silly me, the error occurs when you pass something to --docgen that doesn't exist.

Better repro steps:

$ pulp init
$ psc-docs 'bower_components/*/src/**/*.purs' 'src/**/*.purs' --docgen LOL
psc-docs: error: unknown module "ModuleName [ProperName {runProperName = "LOL"}]"

The culprit is here:

guardMissing [] = return ()
guardMissing [mn] = do
hPutStrLn stderr ("psc-docs: error: unknown module \"" ++ show mn ++ "\"")
exitFailure
guardMissing mns = do
hPutStrLn stderr "psc-docs: error: unknown modules:"
forM_ mns $ \mn ->
hPutStrLn stderr (" * " ++ show mn)
exitFailure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants