Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFix runtime error in native toString (handling null values) #183
Conversation
ThomasWeiser
referenced this pull request
Feb 24, 2015
Closed
Fix runtime error in native toString #182
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThomasWeiser
Mar 10, 2015
Contributor
First I made the PR #182 against the stable branch. You wrote a comment
that made me think I should make the PR against the master branch. So I
did (#183, still open) and closed the first one. Should I reopen #182?
Thanks!
On 10.03.2015 13:19, Kaspar Emanuel wrote:
Why was this closed?
—
Reply to this email directly or view it on GitHub
https://github.com/elm-lang/core/pull/183#issuecomment-78042547.
|
First I made the PR #182 against the stable branch. You wrote a comment Thanks! On 10.03.2015 13:19, Kaspar Emanuel wrote:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kasbah
Mar 10, 2015
Contributor
Yes, no it's fine. I deleted my comment a second after I made it actually. I erroneously thought this PR was closed without comment.
|
Yes, no it's fine. I deleted my comment a second after I made it actually. I erroneously thought this PR was closed without comment. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kasbah
Mar 10, 2015
Contributor
Though you probably want to rebase this on current master so it can be merged more easily.
|
Though you probably want to rebase this on current master so it can be merged more easily. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Ok, I rebased the commit onto current master |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThomasWeiser
Apr 18, 2015
Contributor
@evancz: Would be nice to have the fix in the upcoming 0.15 release.
|
@evancz: Would be nice to have the fix in the upcoming 0.15 release. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Apr 19, 2015
Member
I don't think this is really the right fix. I would expect a Json.Value to appear as an <internal value> or something. I don't think raw JS objects should be printed out the same as records or whatever. I'm not sure how to do this at the moment though.
|
I don't think this is really the right fix. I would expect a |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThomasWeiser
Apr 20, 2015
Contributor
I am not sure, whether Json.Value should be printable or not. I find it very useful to be able to Debug.log these values. Otherwise one would have to patch the generated JavaScript code to insert the logging, which is much more awkward.
Anyway, the current code for toString is incomplete in the sense, that it throws a confusing runtime error for the JavaScript null value. IMHO this should be fixed anyway.
|
I am not sure, whether Anyway, the current code for |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThomasWeiser
May 25, 2015
Contributor
I don't think this is really the right fix. I would expect a Json.Value to appear as an
<internal value>or something.
Ok, I have modified the the code to return "<internal structure>" for null values, as @evancz proposed.
Ok, I have modified the the code to return |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThomasWeiser
Oct 11, 2015
Contributor
Please consider fixing for the upcoming 3.0.0 release (I've just rebased the PR).
This unnecessary runtime error did bite me multiple times.
|
Please consider fixing for the upcoming 3.0.0 release (I've just rebased the PR). This unnecessary runtime error did bite me multiple times. |
jvoigtlaender
referenced this pull request
Jan 19, 2016
Closed
Allow toString to handle null values #477
jvoigtlaender
changed the title from
Fix runtime error in native toString
to
Fix runtime error in native toString (handling null values)
Jan 19, 2016
shamrin
reviewed
Jan 19, 2016
src/Native/Utils.js
| if (v === null) | ||
| { | ||
| return '<internal structure>'; | ||
| } |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shamrin
Jan 19, 2016
The block above seems to have wrong indentation. Tabs vs spaces?
In addition, should this code also handle undefined? E.g. with == null.
shamrin
Jan 19, 2016
The block above seems to have wrong indentation. Tabs vs spaces?
In addition, should this code also handle undefined? E.g. with == null.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThomasWeiser
Jan 19, 2016
Contributor
As far as I can see the source and my fix are both tab indented.
undefined is handled well with the existing code, so it seems sufficient just to test for null.
ThomasWeiser
Jan 19, 2016
Contributor
As far as I can see the source and my fix are both tab indented.
undefined is handled well with the existing code, so it seems sufficient just to test for null.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shamrin
Jan 19, 2016
You are right, there are only tabs in the code. However, you still have unnecessary indent for if body. Brace { should be below i.
shamrin
Jan 19, 2016
You are right, there are only tabs in the code. However, you still have unnecessary indent for if body. Brace { should be below i.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Rebased again on current master |
jvoigtlaender
referenced this pull request
Jan 19, 2016
Closed
Basics.toString leads to runtime error on Html values #488
jvoigtlaender
referenced this pull request
Jan 28, 2016
Closed
Runtime Error: Cannot use 'in' operator to search for 'ctor' in null #438
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
eeue56
Mar 11, 2016
Contributor
FWIW it is very useful to be able to log Json.Value and see the actual JS object. E.g, when working with Http requests, it's a lot nicer if I can debug the data coming down right in my Elm code where it comes down, rather than make a port which I have to send stuff to in order to debug.
|
FWIW it is very useful to be able to log |
ThomasWeiser commentedFeb 24, 2015
toStringneeds special case fornullvalue, otherwise it throws a type error.To reproduce the bug:
toString Json.Encode.nullTypeError: Cannot use 'in' operator to search for '' in null_