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

Improve exception handling in literate programming #360

Closed
neoeinstein opened this issue Dec 13, 2015 · 4 comments
Closed

Improve exception handling in literate programming #360

neoeinstein opened this issue Dec 13, 2015 · 4 comments

Comments

@neoeinstein
Copy link

I've tried include-value, include-output, and include-it. None work if I throw in a Json.parse or Json.tryParse in the same evaluation block. I've even tried re-defining it in the local file and I still can't get any value other than No value has been returned. Any ideas where I am going wrong?

(** Min repro: *)
(*** hide ***)
#I @"packages\Aether\lib\net35"
#I @"packages\Chiron\lib\net45"
#r "Aether.dll"
#r "Chiron.dll"
open Chiron
(** Just Chiron parse: *)
(*** define-output:test***)
Json.parse "{}"
(*** include-it:test ***)
(** Just int parse: *)
(*** define-output:intP ***)
System.Int32.Parse "42"
(*** include-it:intP ***)
(** Both parse: *)
(*** define-output:both ***)
Json.parse "{}"
System.Int32.Parse "42"
(*** include-it:both ***)
(** Yep... *)

In both blocks where Json.parse is invoked, the include block shows No value has been returned.

Also of interest are these blocks:

Number 125m |> Json.format

binds correctly, but

"125" |> Json.parse |> Json.format

doesn't bind either.

@neoeinstein neoeinstein changed the title Values bound in a block including a Chiron Json.parse or Json.tryParse are not being lost Values bound in a block including a Chiron Json.parse or Json.tryParse are being lost Dec 13, 2015
@neoeinstein
Copy link
Author

I think I just found the silent error that wasn't being propogated back to me:

System.TypeInitializationException: The type initializer for '<StartupCode$Chiron>.$Chiron' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'FParsec, Version=1.0.0.0, Culture=neutral, PublicKeyToken=40ccfc0a09edbb5d' or one of its dependencies. The system cannot find the file specified.
   at <StartupCode$Chiron>.$Chiron..cctor()
   --- End of inner exception stack trace ---
   at Chiron.Parsing.Json.get_parse()
   at <StartupCode$FSI_0021>.$FSI_0021.main@()

@neoeinstein
Copy link
Author

Yep. This was mainly on my end. Adding the appropriate reference to FParsec made things magically work again. Is there a way to propagate this error back as the result for any bound value when such a binding error occurs during evaluation?

@matthid
Copy link
Member

matthid commented Jan 14, 2016

Was the exception logged properly? How did you find it? Where did you expect it in the first place?

@matthid matthid changed the title Values bound in a block including a Chiron Json.parse or Json.tryParse are being lost Improve exception handling in literate programming Jan 14, 2016
@matthid
Copy link
Member

matthid commented Jan 14, 2016

Tracked in #370

@matthid matthid closed this as completed Jan 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants