Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cd39e77

Browse files
committed
Expose errors in change event detail
1 parent 8781f62 commit cd39e77

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/Json/Form.elm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Task
3131

3232
type ExternalMsg
3333
= None
34-
| UpdateValue (Maybe JsonValue) Bool
34+
| UpdateValue (Maybe JsonValue) (DictPath(ListString))
3535

3636

3737
type alias Model =
@@ -405,16 +405,20 @@ editValue model path val =
405405
}
406406
, Cmd.none
407407
)
408-
|> withExMsg (UpdateValue (Just updatedJsonValue) True)
408+
|> withExMsg (UpdateValue (Just updatedJsonValue) Dict.empty)
409409

410410
Err e ->
411+
let
412+
errors =
413+
dictFromListErrors e
414+
in
411415
( { model
412416
| value = Just updatedJsonValue
413-
, errors = dictFromListErrors e
417+
, errors = errors
414418
}
415419
, Cmd.none
416420
)
417-
|> withExMsg (UpdateValue (Just updatedJsonValue) False)
421+
|> withExMsg (UpdateValue (Just updatedJsonValue) errors)
418422

419423

420424
dictFromListErrors : List Error -> Dict Path (List String)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /