{"action":"created","issue":{"url":"https://api.github.com/repos/sass/sass/issues/1763","labels_url":"https://api.github.com/repos/sass/sass/issues/1763/labels{/name}","comments_url":"https://api.github.com/repos/sass/sass/issues/1763/comments","events_url":"https://api.github.com/repos/sass/sass/issues/1763/events","html_url":"https://github.com/sass/sass/issues/1763","id":93254040,"number":1763,"title":"incorrect error message $map when passing variable as an argument","user":{"login":"petermakowski","id":7452681,"avatar_url":"https://avatars.githubusercontent.com/u/7452681?v=3","gravatar_id":"","url":"https://api.github.com/users/petermakowski","html_url":"https://github.com/petermakowski","followers_url":"https://api.github.com/users/petermakowski/followers","following_url":"https://api.github.com/users/petermakowski/following{/other_user}","gists_url":"https://api.github.com/users/petermakowski/gists{/gist_id}","starred_url":"https://api.github.com/users/petermakowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermakowski/subscriptions","organizations_url":"https://api.github.com/users/petermakowski/orgs","repos_url":"https://api.github.com/users/petermakowski/repos","events_url":"https://api.github.com/users/petermakowski/events{/privacy}","received_events_url":"https://api.github.com/users/petermakowski/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-06T11:17:32Z","updated_at":"2015-07-10T18:16:29Z","closed_at":"2015-07-10T18:16:28Z","body":"I am running `Sass 3.4.15 (Selective Steve)`.\r\nWhen I try to pass a variable as an argument to a sass map:\r\n\r\n    @function palette($palette, $shade: 'base') {\r\n      @return map-get(map-get($palettes, $palette), $shade);\r\n    }\r\n\r\n    color: palette($color-primary, dark);\r\n\r\nI get an error message pinpointing the function line number instead of actual source of the problem:\r\n`$map: null is not a map for 'map-get'`\r\n\r\nI was trying to figure it our for a while, thought it's a Sass bug.\r\nError message could be more helpful than that, really!\r\n\r\nRelated to: https://github.com/sass/sass/issues/1519"},"comment":{"url":"https://api.github.com/repos/sass/sass/issues/comments/120484446","html_url":"https://github.com/sass/sass/issues/1763#issuecomment-120484446","issue_url":"https://api.github.com/repos/sass/sass/issues/1763","id":120484446,"user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T18:16:28Z","updated_at":"2015-07-10T18:16:28Z","body":"Without further information, I assume that either `$palettes` or `map-get($palettes, $palette)` is `null`. Given that, Sass doesn't have the context to tell you any more information about what went wrong. It doesn't keep a detailed history of where each object came from; as far as it knows, the place you passed `null` to `map-get` *is* the source of the problem.\r\n\r\nIf you want better error handling in that function, you're welcome to add it yourself:\r\n\r\n```scss\r\n@function palette($palette, $shade: 'base') {\r\n  $palette-map: map-get($palettes, $palette);\r\n  @if $palette-map == null {\r\n    @error \"#{$palette} is not a valid palette name.\"\r\n  }\r\n\r\n  @return map-get($palette-map, $shade);\r\n}\r\n\r\ncolor: palette($color-primary, dark);\r\n```"}}