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

Fix Staticman error #6215

Closed
hendrixjoseph opened this issue Jul 15, 2019 · 1 comment
Closed

Fix Staticman error #6215

hendrixjoseph opened this issue Jul 15, 2019 · 1 comment

Comments

@hendrixjoseph
Copy link
Owner

From @VincentTam's original pull request

Can't leave a comment. The UI text message is incorrect. It's better to display an error message in case of failure. Since I can't create an issue, I've to start a PR. See Staticman PR 243 for details.

Screenshot from 2019-07-13 15-00-32

Staticman API's response:

{
  "JSON": {
    "success": false,
    "rawError": {
      "name": "HttpError",
      "status": 500,
      "headers": {},
      "request": {
        "method": "PUT",
        "url": "https://api.github.com/repos/hendrixjoseph/hendrixjoseph.github.io/contents/_data/comments/2019-goal-check-in/entry1563022797012.yml",
        "headers": {
          "accept": "application/vnd.github.v3+json",
          "user-agent": "Staticman agent octokit.js/16.8.0 Node.js/11.12.0 (Linux 4.4; x64)",
          "authorization": "token fbb9e50e161f8f0286d01714050f45416e6f9c1c",
          "content-type": "application/json; charset=utf-8"
        },
        "body": "{\"message\":\"Add Staticman comment from Vin100 Tam at https://vincenttam.gitlab.io\",\"content\":\"X2lkOiAxY2ZhNDRhMC1hNTZlLTExZTktYWQwZS1lOWI4Nzc3YzBkYjQKbXNnOiBUZXN0IGNvbW1lbnQKbmFtZTogVmluMTAwIFRhbQplbWFpbDogZTEzYjI5ZDlkMmU2OTQwMzJlZGIyNThmYjY4MTE0M2IKdXJsOiAnaHR0cHM6Ly92aW5jZW50dGFtLmdpdGxhYi5pbycKZGF0ZTogMTU2MzAyMjc5Nwo=\",\"branch\":\"staticman_1cfa44a0-a56e-11e9-ad0e-e9b8777c0db4\"}",
        "request": {
          "timeout": 5000,
          "validate": {
            "author": {
              "type": "object"
            },
            "author.email": {
              "required": true,
              "type": "string"
            },
            "author.name": {
              "required": true,
              "type": "string"
            },
            "branch": {
              "type": "string"
            },
            "committer": {
              "type": "object"
            },
            "committer.email": {
              "required": true,
              "type": "string"
            },
            "committer.name": {
              "required": true,
              "type": "string"
            },
            "content": {
              "required": true,
              "type": "string"
            },
            "message": {
              "required": true,
              "type": "string"
            },
            "owner": {
              "required": true,
              "type": "string"
            },
            "path": {
              "required": true,
              "type": "string"
            },
            "repo": {
              "required": true,
              "type": "string"
            }
          }
        }
      },
      "_smErrorCode": "GITHUB_WRITING_FILE"
    },
    "errorCode": "GITHUB_WRITING_FILE"
  },
  "Response payload": {
    "EDITOR_CONFIG": {
      "text": "{\"success\":false,\"rawError\":{\"name\":\"HttpError\",\"status\":500,\"headers\":{},\"request\":{\"method\":\"PUT\",\"url\":\"https://api.github.com/repos/hendrixjoseph/hendrixjoseph.github.io/contents/_data/comments/2019-goal-check-in/entry1563022797012.yml\",\"headers\":{\"accept\":\"application/vnd.github.v3+json\",\"user-agent\":\"Staticman agent octokit.js/16.8.0 Node.js/11.12.0 (Linux 4.4; x64)\",\"authorization\":\"token fbb9e50e161f8f0286d01714050f45416e6f9c1c\",\"content-type\":\"application/json; charset=utf-8\"},\"body\":\"{\\\"message\\\":\\\"Add Staticman comment from Vin100 Tam at https://vincenttam.gitlab.io\\\",\\\"content\\\":\\\"X2lkOiAxY2ZhNDRhMC1hNTZlLTExZTktYWQwZS1lOWI4Nzc3YzBkYjQKbXNnOiBUZXN0IGNvbW1lbnQKbmFtZTogVmluMTAwIFRhbQplbWFpbDogZTEzYjI5ZDlkMmU2OTQwMzJlZGIyNThmYjY4MTE0M2IKdXJsOiAnaHR0cHM6Ly92aW5jZW50dGFtLmdpdGxhYi5pbycKZGF0ZTogMTU2MzAyMjc5Nwo=\\\",\\\"branch\\\":\\\"staticman_1cfa44a0-a56e-11e9-ad0e-e9b8777c0db4\\\"}\",\"request\":{\"timeout\":5000,\"validate\":{\"author\":{\"type\":\"object\"},\"author.email\":{\"required\":true,\"type\":\"string\"},\"author.name\":{\"required\":true,\"type\":\"string\"},\"branch\":{\"type\":\"string\"},\"committer\":{\"type\":\"object\"},\"committer.email\":{\"required\":true,\"type\":\"string\"},\"committer.name\":{\"required\":true,\"type\":\"string\"},\"content\":{\"required\":true,\"type\":\"string\"},\"message\":{\"required\":true,\"type\":\"string\"},\"owner\":{\"required\":true,\"type\":\"string\"},\"path\":{\"required\":true,\"type\":\"string\"},\"repo\":{\"required\":true,\"type\":\"string\"}}}},\"_smErrorCode\":\"GITHUB_WRITING_FILE\"},\"errorCode\":\"GITHUB_WRITING_FILE\"}",
      "mode": "application/json"
    }
  }
}
@hendrixjoseph
Copy link
Owner Author

Thanks!

I've updated the UI to show errors. Previously when staticman returned an error it still worked (pull request and everything).

Here's an example with an error:

image

(Note that I have resolved the above error).

I did notice a branch with your user name in it - branch staticman_1cfa44a0-a56e-11e9-ad0e-e9b8777c0db4

I'm currently working on updating to v3 of staticman and the Staticman app, but seem to be running into some issues. I'm re-enabled issues for the "back end" of my blog, as well.

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