{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/12505","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/12505/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/12505/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/12505/events","html_url":"https://github.com/JuliaLang/julia/issues/12505","id":99677574,"number":12505,"title":"Exceptions from __init__() being caught","user":{"login":"phobon","id":3770090,"avatar_url":"https://avatars.githubusercontent.com/u/3770090?v=3","gravatar_id":"","url":"https://api.github.com/users/phobon","html_url":"https://github.com/phobon","followers_url":"https://api.github.com/users/phobon/followers","following_url":"https://api.github.com/users/phobon/following{/other_user}","gists_url":"https://api.github.com/users/phobon/gists{/gist_id}","starred_url":"https://api.github.com/users/phobon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phobon/subscriptions","organizations_url":"https://api.github.com/users/phobon/orgs","repos_url":"https://api.github.com/users/phobon/repos","events_url":"https://api.github.com/users/phobon/events{/privacy}","received_events_url":"https://api.github.com/users/phobon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/error%20handling","name":"error handling","color":"02d7e1"}],"state":"open","locked":false,"assignee":{"login":"vtjnash","id":330950,"avatar_url":"https://avatars.githubusercontent.com/u/330950?v=3","gravatar_id":"","url":"https://api.github.com/users/vtjnash","html_url":"https://github.com/vtjnash","followers_url":"https://api.github.com/users/vtjnash/followers","following_url":"https://api.github.com/users/vtjnash/following{/other_user}","gists_url":"https://api.github.com/users/vtjnash/gists{/gist_id}","starred_url":"https://api.github.com/users/vtjnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtjnash/subscriptions","organizations_url":"https://api.github.com/users/vtjnash/orgs","repos_url":"https://api.github.com/users/vtjnash/repos","events_url":"https://api.github.com/users/vtjnash/events{/privacy}","received_events_url":"https://api.github.com/users/vtjnash/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2015-08-07T15:57:51Z","updated_at":"2015-08-12T18:36:03Z","closed_at":null,"body":"```\r\nmodule X\r\n    __init__() = error(\"Something went wrong\")\r\nend\r\nWARNING: error initializing module X:\r\nErrorException(\"Something went wrong\")\r\n```\r\nWhy is the exception caught and just a warning message printed? I did some basic searching but could not find any reference or explanation for this. Should I not have the ability to send an error to the top-level if something goes wrong when my module is being initialized?"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/130406293","html_url":"https://github.com/JuliaLang/julia/issues/12505#issuecomment-130406293","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/12505","id":130406293,"user":{"login":"vtjnash","id":330950,"avatar_url":"https://avatars.githubusercontent.com/u/330950?v=3","gravatar_id":"","url":"https://api.github.com/users/vtjnash","html_url":"https://github.com/vtjnash","followers_url":"https://api.github.com/users/vtjnash/followers","following_url":"https://api.github.com/users/vtjnash/following{/other_user}","gists_url":"https://api.github.com/users/vtjnash/gists{/gist_id}","starred_url":"https://api.github.com/users/vtjnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtjnash/subscriptions","organizations_url":"https://api.github.com/users/vtjnash/orgs","repos_url":"https://api.github.com/users/vtjnash/repos","events_url":"https://api.github.com/users/vtjnash/events{/privacy}","received_events_url":"https://api.github.com/users/vtjnash/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T18:36:03Z","updated_at":"2015-08-12T18:36:03Z","body":"i thought Jeff had a position that there should never be a case where emitting a warning is the intended behavior. \r\n\r\n> I think there was some desire to prevent an exception in one module's __init__ from stopping others from running.\r\n\r\nI think you fixed the order sufficiently so that this is not as much of a concern. When it was originally implemented, the list could contain unrelated modules so it was necessary to run through all of them, but with https://github.com/tkelman/julia/commit/506ecbe2f83854a46ef8f7662830da38795a0d2c, i think it's safe to abort.\r\n\r\nto argue the other side, however, I sometimes (with invalid build trees), get errors during startup that some library couldn't be found (such as libgmp). It's currently rather nice that it is non-fatal (although only because I am not intending to use anything from that module). Brainstorming this further however, perhaps in the future, we could some sort of \"stub\" module that acts as a placeholder for a real module, but which actually holds an error. This might also potentially be an improvement for the following code (among others):\r\n```\r\n> using Foo\r\nLoadError: threw foobar\r\n\r\n# current behavior\r\n> using Foo\r\n# nothing\r\n\r\n# possible behavior?\r\n> using Foo\r\nModuleDefinitionError in Foo: LoadError: threw foobar\r\n\r\n# and also?\r\n> Foo.bar\r\nModuleDefinitionError in Foo: LoadError: threw foobar\r\n```"}}