Skip to content

Commit b918d17

Browse files
authored
Merge pull request #346 from gren-lang/push-kovurosrssvk
Filter out invalid module names from project source files.
2 parents 7027a4c + acfe301 commit b918d17

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Terminal/PackageInstall.gren

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import Json.Decode as Decode exposing (Decoder)
4242
import Stream.Extra
4343
import Terminal.Help as Help
4444
import Terminal.Report as Report exposing (Report)
45+
import Compiler.ModuleName as ModuleName
4546

4647

4748
type alias Config =
@@ -193,7 +194,18 @@ run config { projectPath, outline } =
193194
, outline = outline
194195
, projectSources =
195196
Array.foldl
196-
(\{ path, moduleName, source } dict -> Dict.set moduleName { path = path, data = source } dict)
197+
(\{ path, moduleName, source } dict ->
198+
-- TODO: Temporary fix. Should be handled in compiler-node
199+
when ModuleName.fromString moduleName is
200+
Just _ ->
201+
Dict.set moduleName { path = path, data = source } dict
202+
203+
Nothing ->
204+
-- Filter out bad module names.
205+
-- The real solution should give a better error message, but this
206+
-- at least prevents the backend crashing with cryptic json error.
207+
dict
208+
)
197209
Dict.empty
198210
sourceFiles
199211
, startedDownload = False

0 commit comments

Comments
 (0)