Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple onError case appears to not work #28

Open
dillonkearns opened this issue Jul 25, 2019 · 0 comments
Open

Simple onError case appears to not work #28

dillonkearns opened this issue Jul 25, 2019 · 0 comments

Comments

@dillonkearns
Copy link

Hey Matt!

I'm loving the new version, thanks for all the work on this.

I have tried Mark.onError in a few different cases and haven't seen it work. In each case, I get a Document mismatch error:

Image 2019-07-25 at 9 23 26 AM

Steps to reproduce

Apply this diff in the examples folder and run the app with

cd examples/blog && elm-live src/Main.elm --open
diff --git a/examples/blog/articles/Ipsum.emu b/examples/blog/articles/Ipsum.emu
index f9bf692..747b1d5 100644
--- a/examples/blog/articles/Ipsum.emu
+++ b/examples/blog/articles/Ipsum.emu
@@ -4,6 +4,8 @@
     description =
         How I learned to use elm-markup.
 
+|> Simple
+    Hello!
 
 `Lorem Ipsum is simply`{drop} --- dummy text of the printing and [typesetting industry]{link| url = http://mechanical-elephant.com }. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
 
diff --git a/examples/blog/src/Main.elm b/examples/blog/src/Main.elm
index 9ba8be5..e86fbed 100644
--- a/examples/blog/src/Main.elm
+++ b/examples/blog/src/Main.elm
@@ -144,6 +144,7 @@ document =
                 , image
                 , list
                 , code
+                , simple
                 , Mark.map (Html.p []) text
                 ]
         }
@@ -235,6 +236,23 @@ header =
         text
 
 
+simple =
+    Mark.block "Simple"
+        (\string ->
+            Html.text string
+        )
+        (Mark.string
+            |> Mark.verify
+                (\string ->
+                    Err
+                        { title = "Forced error"
+                        , message = [ "This is just a test." ]
+                        }
+                )
+            |> Mark.onError "I found an error!"
+        )
+
+
 image =
     Mark.record "Image"
         (\src description ->

I think Mark.onError would be a really cool feature for some of the static site generation I'm working on! Let me know if there's anything I can do to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant