nucleartide/ember-elm

Use 'report' argument to get elm errors as JSON

Closed this issue · 1 comments

There is an report argument on elm make.

    --report=<report-type>
        You can say --report=json to get error messages as JSON. This is only
        really useful if you are an editor plugin. Humans should avoid it!

It should simplify error handling and allow for nice error messages.

Okay, I did some research and it seems that it's mainly for editor plugins.

It give a following output

{
   "type":"compile-errors",
   "errors":[
      {
         "path":"~/ember-elm/tmp/elm_compiler-input_base_path-nEJC1ryT.tmp/dummy/elm-modules/Hello.elm",
         "name":"Hello",
         "problems":[
            {
               "title":"TOO MANY ARGS",
               "region":{
                  "start":{
                     "line":7,
                     "column":5
                  },
                  "end":{
                     "line":7,
                     "column":9
                  }
               },
               "message":[
                  "The `text` function expects 1 argument, but it got 2 instead.\n\n7|     text \"hello world\" 1\n       ",
                  {
                     "bold":false,
                     "underline":false,
                     "color":"red",
                     "string":"^^^^"
                  },
                  "\nAre there any missing commas? Or missing parentheses?"
               ]
            }
         ]
      }
   ]
}

I think we're fine with basic text output as it is already nicely formatted and gives good enough overview where the issue is.