This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from Gizra/97-error-handling
Error handling and Translate
- Loading branch information
Showing
29 changed files
with
3,235 additions
and
691 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module App.Utils | ||
exposing | ||
( handleErrors | ||
) | ||
|
||
import App.Model exposing (Model, Msg(..)) | ||
import Error.Model exposing (Error) | ||
import Error.Utils exposing (debugLog) | ||
import Maybe.Extra exposing (unwrap) | ||
|
||
|
||
{-| If there was an error, add it to the top of the list, | ||
and send to console. | ||
-} | ||
handleErrors : Maybe Error -> Model -> Model | ||
handleErrors maybeError model = | ||
let | ||
errors = | ||
unwrap model.errors | ||
(\error -> | ||
let | ||
_ = | ||
debugLog error | ||
in | ||
error :: model.errors | ||
) | ||
maybeError | ||
in | ||
{ model | errors = errors } |
Oops, something went wrong.