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

[Docs] Error Codes Page #6946

Merged
merged 9 commits into from Jun 4, 2016
Merged

Conversation

keyz
Copy link
Contributor

@keyz keyz commented Jun 1, 2016

Implements the 2nd part of #6874. The JSON file built by #6882 is now fed to the page.

CC @spicyj @zpao since this PR modifies the build steps of our docs. Thanks!

A demo can be found here.

desc "copy error codes to docs"
task :copy_error_codes do
codes_json = File.read('../scripts/error-codes/codes.json')
codes_js = "var errorMap = ".concat(codes_json)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codes_js = 'var errorMap = ' + codes_json + ';'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just go all the way and use interpolation.

codes_js = "var errorMap = #{codes_json};"

Copy link
Contributor Author

@keyz keyz Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about codes_js = "var errorMap = #{codes_json.chomp};\n"?

@ghost
Copy link

ghost commented Jun 1, 2016

@keyanzhang updated the pull request.

@ghost
Copy link

ghost commented Jun 2, 2016

@keyanzhang updated the pull request.

@keyz keyz mentioned this pull request Jun 3, 2016
@ghost
Copy link

ghost commented Jun 3, 2016

@keyanzhang updated the pull request.

const segments = str.split(urlRegex);

for (let i = 0; i < segments.length; i++) {
const matchIdx = matchResult.indexOf(segments[i]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to run a separate match; with the split regex you have the URLs will always be in odd positions and the text in even positions.

@sophiebits
Copy link
Collaborator

This generally looks good to me. I want to work on the wording a bit: will comment here later today.

@ghost
Copy link

ghost commented Jun 3, 2016

@keyanzhang updated the pull request.

@@ -0,0 +1,15 @@
---
id: error-codes
title: React Error Codes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested "Error Decoder" and still like that (I think it's cute) but if you prefer this let's just do "Error Codes" without the "React".

@ghost
Copy link

ghost commented Jun 3, 2016

@keyanzhang updated the pull request.

@sophiebits
Copy link
Collaborator

Looks great, thanks!

@keyz keyz merged commit cf73de9 into facebook:master Jun 4, 2016
@keyz keyz deleted the site-reassemble-error-page branch June 4, 2016 21:44
keyz added a commit that referenced this pull request Jun 7, 2016
(cherry picked from commit cf73de9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants