{"action":"created","issue":{"url":"https://api.github.com/repos/kemalcr/kemal/issues/369","repository_url":"https://api.github.com/repos/kemalcr/kemal","labels_url":"https://api.github.com/repos/kemalcr/kemal/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/kemalcr/kemal/issues/369/comments","events_url":"https://api.github.com/repos/kemalcr/kemal/issues/369/events","html_url":"https://github.com/kemalcr/kemal/issues/369","id":234827759,"number":369,"title":"Missing view gives an unclear error message","user":{"login":"Fryguy","id":52120,"avatar_url":"https://avatars0.githubusercontent.com/u/52120?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryguy","html_url":"https://github.com/Fryguy","followers_url":"https://api.github.com/users/Fryguy/followers","following_url":"https://api.github.com/users/Fryguy/following{/other_user}","gists_url":"https://api.github.com/users/Fryguy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryguy/subscriptions","organizations_url":"https://api.github.com/users/Fryguy/orgs","repos_url":"https://api.github.com/users/Fryguy/repos","events_url":"https://api.github.com/users/Fryguy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryguy/received_events","type":"User","site_admin":false},"labels":[{"id":277058249,"url":"https://api.github.com/repos/kemalcr/kemal/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-09T13:31:58Z","updated_at":"2017-06-09T13:35:47Z","closed_at":null,"body":"I accidentally put my views directory into the src directory, but had a get statement like the following:\r\n\r\n```crystal\r\nrequire \"kemal\"\r\n\r\nget \"/\" do\r\n  render \"views/index.ecr\"\r\nend\r\n\r\nKemal.run\r\n```\r\n\r\nThis caused Kemal to not find the view, which is correct, however the error message produced in no way told me that:\r\n\r\n```text\r\n$ crystal build src/kemal_crystal_bug.cr\r\nError in macro 'embed' /Users/jfrey/projects/kemal_crystal_bug/lib/kilt/src/kilt.cr:12, line 4:\r\n\r\n   1.\r\n   2.\r\n   3.\r\n>  4.       ECR.embed(\"views/index.ecr\", \"__kilt_io__\", )\r\n   5.\r\n   6.\r\n\r\nexpanding macro\r\nin macro 'embed' /usr/local/Cellar/crystal-lang/0.22.0/src/ecr/macros.cr:69, line 1:\r\n\r\n>  1.     {{ run(\"ecr/process\", \"views/index.ecr\", \"__kilt_io__\") }}\r\n   2.\r\n\r\nexpanding macro\r\nin macro 'embed' /Users/jfrey/projects/kemal_crystal_bug/lib/kilt/src/kilt.cr:12, line 4:\r\n\r\n   1.\r\n   2.\r\n   3.\r\n>  4.       ECR.embed(\"views/index.ecr\", \"__kilt_io__\", )\r\n   5.\r\n   6.\r\n\r\nexpanding macro\r\nin macro 'embed' /usr/local/Cellar/crystal-lang/0.22.0/src/ecr/macros.cr:69, line 1:\r\n\r\n>  1.     {{ run(\"ecr/process\", \"views/index.ecr\", \"__kilt_io__\") }}\r\n   2.\r\n\r\nError executing run: ecr/process \"views/index.ecr\" \"__kilt_io__\"\r\n\r\nGot:\r\n\r\n\r\n```\r\n\r\nI did not expect the \"Got:\" part to be empty, and instead expected something closer to the kind of error from a missing require file: `Error in src/bar.cr:1: while requiring \"foo\": can't find file 'foo' relative to '/Users/jfrey/projects/bar/src'`\r\n\r\nI'm not sure if the lack of an error message is a Kemal bug or a bug in ECR.  I figured I'd open it up here first to start the journey.\r\n\r\nIt took me a while to figure out what was going on.  I'm new to kemal, and didn't know the views directory was relative to the project root.  I thought it was relative to the main .cr file, hence why I put the views directory under my src directory.  I couldn't find any good documentation on an expected directory structure of the project, and didn't realize my error until I found the sample kemal-chat app.  I'm willing to update the documentation for this, but not sure where it is supposed to go (i.e. should it be a new page in https://github.com/kemalcr/kemalcr.com/tree/master/_docs or just as a part of one of the existing pages there?)"},"comment":{"url":"https://api.github.com/repos/kemalcr/kemal/issues/comments/307390239","html_url":"https://github.com/kemalcr/kemal/issues/369#issuecomment-307390239","issue_url":"https://api.github.com/repos/kemalcr/kemal/issues/369","id":307390239,"user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars3.githubusercontent.com/u/990485?v=3","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"created_at":"2017-06-09T13:35:47Z","updated_at":"2017-06-09T13:35:47Z","body":"Welcome @Fryguy , thanks for using Kemal.\r\n\r\nUnfortunately the error message comes from `ecr` which is included in Crystal itself. \r\nAbout the file structure you can improve the http://kemalcr.com/docs/views/ docs which is located in https://github.com/kemalcr/kemalcr.com/blob/master/_docs/views.md"}}
{"actor":{"display_login":"sdogruyol"}}