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

Graceful failure #37

Open
sizzlemctwizzle opened this issue Nov 14, 2013 · 2 comments
Open

Graceful failure #37

sizzlemctwizzle opened this issue Nov 14, 2013 · 2 comments
Labels
enhancement Something we do have implemented already but needs improvement upon to the best of knowledge.
Milestone

Comments

@sizzlemctwizzle
Copy link
Member

When we encounter an error almost anywhere, we should handle it and fail gracefully.

@jerone
Copy link
Contributor

jerone commented Nov 14, 2013

And log the error.

@jerone
Copy link
Contributor

jerone commented Jun 22, 2014

Partial implemented by using 404

Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Dec 6, 2014
* Directly related to OpenUserJS#37. Stops net timeout when picking some other script that isn't present in fakeS3. Eventually when *aws-sdk* is updated this will be needed so it doesn't halt dev.

Possibly applicable routine to OpenUserJS#486 for inline live migration
@Martii Martii mentioned this issue Jan 23, 2015
Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Jan 30, 2015
* Basic statusCodePage for those users who are accidentally/intentionally putting in blank comments... applies to OpenUserJS#37
* Some missed Apps Hungarian from OpenUserJS#264 ... there's probably more. ;)
* Some STYLEGUIDE.md conformance with braces, newlines and indention
* Stray trailing comma fix
* Flip Cancel and Reply buttons... this may be some of the accidents with empty comments. Most likely when someone is going full screen they might be clicking reply on touch screens... favor canceling instead of replying if that's the case
Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Mar 23, 2016
* Move other JSON minification to `JSON.stringify` instead of *express-minify*... applies to OpenUserJS#432 and followup for OpenUserJS#899
* Remove some legacy dead code w/ route... can cause server trip
* Add some graceful failures for JSON pages... applies to OpenUserJS#37
* Stop using `res.json` as it's not very configurable... do it manually with `Content-Type` header and such
* Add `virtuals` to JSON output if available
* Fix `find` to `findOne` in moderation removed item routine... removes outer `Array` notation and makes it look more like the model... one would hope there would be a unique id in this case
* Add a missing `charset`

Applies to OpenUserJS#249 and some of OpenUserJS#262
Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Apr 7, 2016
* `BUSY_LAG` environment var so this can be twiddled with later
* `FORCE_BUSY` environment var to indicate technical difficulties with styling
* `FORCE_BUSY_ABSOLUTE` environment var to indicate technical difficulties with no UI
* Change the messages to suit

**NOTE**
This is also to test to see where the memory leak is happening... *mu2* isn't leaking since the hard-coded 503 has been in place and the average memory usage is around ~6%

Applies to OpenUserJS#944, OpenUserJS#249 and OpenUserJS#37
Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Apr 8, 2016
* Make calls explicit to minimize possible accidental server trip during certain conditions. I would have combined these but with the server hit in OpenUserJS#944 we are teetering with ENOMEM failures
* Stray commas removed
* Make some of the output pretty ... inversely related to OpenUserJS#37
* Reorder /admin route on most likely utilized FIFO
* Move clone identify to /admin tools as well

**NOTE**
This should fix the main /about route from 500

Applies to OpenUserJS#944
Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Apr 15, 2016
* Normalize on username standards and do a precheck so we don't track some obvious bad requests. This should lower the MongoLab traffic a little.
* Remove a stray comma
* Fixed a bug in lib detection... technically this was refactored out.
* Removed last commit unused var

**NOTES**
Consider `keyScript` as a preop to make sure we're "trying the right kind of key in the lock first" which just happens to be our `installName` :)

Applies to OpenUserJS#944 and a little to OpenUserJS#37 *(silence is golden)*
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Nov 21, 2017
* Some reworking of graceful failures to indicate what they are
* This probably should have been done around the time `statusCodePage` was implemented with ES5 compatible inheritance. May move this routine to debug.js
* One comment BUG fixed
* These trapped errors are `throw`able if we choose

NOTES:
* Almost named the inherited `Error` Object as `userError` since that's what most of these end up being. ;)
* **NOT** tested yet with the webhook... have to merge first. GitHub doesn't seem to show the statusMessage so might be out of luck here. 400 is User Error 500 is Server Error *(usually... have a few Watchpoints to figure out if they are the correct code)*
* This is pass number 1 ... optimizing/tweaking will come later after this testing and additional respite... including some possible status code changes

Applies to OpenUserJS#37
Martii added a commit that referenced this issue Nov 21, 2017
* Some reworking of graceful failures to indicate what they are
* This probably should have been done around the time `statusCodePage` was implemented with ES5 compatible inheritance. May move this routine to debug.js
* One comment BUG fixed
* These trapped errors are `throw`able if we choose

NOTES:
* Almost named the inherited `Error` Object as `userError` since that's what most of these end up being. ;)
* **NOT** tested yet with the webhook... have to merge first. GitHub doesn't seem to show the statusMessage so might be out of luck here. 400 is User Error 500 is Server Error *(usually... have a few Watchpoints to figure out if they are the correct code)*
* This is pass number 1 ... optimizing/tweaking will come later after this testing and additional respite... including some possible status code changes

Applies to #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Nov 28, 2017
* Some Code condensing in the process as a result

NOTES:
* Some of the errors returned may still be strings instead of an Error *(subclassed or not)* so add default conditional for that. Usually those are 400 user errors but could be 500 server error... unknown at this time.

Post OpenUserJS#1284 OpenUserJS#1289 and OpenUserJS#1274 OpenUserJS#37
Martii added a commit that referenced this issue Nov 28, 2017
* Some Code condensing in the process as a result

NOTES:
* Some of the errors returned may still be strings instead of an Error *(subclassed or not)* so add default conditional for that. Usually those are 400 user errors but could be 500 server error... unknown at this time.

Post #1284 #1289 and #1274 #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Feb 10, 2018
* `statusCode` is a string in the case of *node* failures... change `statusCodePage` code to accommodate this.
* revert suspension again... hopefully the last time

Applies to OpenUserJS#1323 and OpenUserJS#37
Martii added a commit that referenced this issue Feb 10, 2018
* `statusCode` is a string in the case of *node* failures... change `statusCodePage` code to accommodate this.
* revert suspension again... hopefully the last time

Applies to #1323 and #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue May 22, 2018
* Rather than just a 404 page... redirect to login page and denote with QSP when data present
* Some compliance with STYLEGUIDE.md max line length

Applies to OpenUserJS#1369 and OpenUserJS#37
Martii added a commit that referenced this issue May 22, 2018
* Rather than just a 404 page... redirect to login page and denote with QSP when data present
* Some compliance with STYLEGUIDE.md max line length

Applies to #1369 and #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Jun 12, 2018
* Use very short session before successful auth. Session "bleeding" briefly mentioned at OpenUserJS#1411 . This is "expanded" after successful auth.
* Output `originalMaxAge` for sync check in *express-session* via MongoDB
* Don't easily expose improper/expired callbacks. Part of OpenUserJS#37
* Remove some currently unneeded `return` statements already captured by block braces

Related to OpenUserJS#604 OpenUserJS#1201 OpenUserJS#1202 and OpenUserJS#1393
Martii added a commit that referenced this issue Jun 12, 2018
* Use very short session before successful auth. Session "bleeding" briefly mentioned at #1411 . This is "expanded" after successful auth.
* Output `originalMaxAge` for sync check in *express-session* via MongoDB
* Don't easily expose improper/expired callbacks. Part of #37
* Remove some currently unneeded `return` statements already captured by block braces

Related to #604 #1201 #1202 and #1393 

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Oct 28, 2018
* Relax `isPro` requirement in a few areas and rely upon `isSecured` as primary test condition
* Trap TLS failure if certs are already expired
* Change some verbiage so we know which routine tripped it. e.g. `...ing` vs `...ed`. This routine didn't work last time however things are of course different this year. This use case is finite to detect.

Post OpenUserJS#1532 OpenUserJS#1533 and OpenUserJS#37
Martii added a commit that referenced this issue Oct 28, 2018
* Relax `isPro` requirement in a few areas and rely upon `isSecured` as primary test condition
* Trap TLS failure if certs are already expired
* Change some verbiage so we know which routine tripped it. e.g. `...ing` vs `...ed`. This routine didn't work last time however things are of course different this year. This use case is finite to detect.

Post #1532 #1533 and #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Dec 21, 2018
* These are mostly comments in this PR
* Normalized a few more identifiers to their standards for easier grep'ing. I'm sure there's more.
* Some of these may be silent as intended... they should be denoted as such... like `fallthrough` for `switch` should be normally
* Some of these assume that AWS S3 and MongoLabs are perfectly connected and no issues... bad idea. This is what I was describing. We need [OpenUserJS#37](Graceful failure) whether it's a comment, a console message, a page, or some combination of these.
* This doesn't include MongoDB calls that just use `save()` for example... which is not recommended at all. Error traps are good when connecting to third parties whether they are local or remote. I'm not perfect either but I can get easily burned out on fixing these which is why I work in stages instead of all at once. Don't get paid for that! ;) :) Always fill out the arguments if known especially with `aErr`. That's a reason why it's done first in this coding style.
* This was a very brief skim over the code... hopefully it wasn't overzealous or underzealous in code points... but they are comments to be addressed eventually. Living on four hours of sleep in 3 days isn't good so I'm taking a break not to mention a few days away from holiday days.

Applies to OpenUserJS#430 and indirectly to OpenUserJS#1548

Signed-off-by: Martii <martii@users.noreply.github.com>
Martii added a commit that referenced this issue Dec 21, 2018
* These are mostly comments in this PR
* Normalized a few more identifiers to their standards for easier grep'ing. I'm sure there's more.
* Some of these may be silent as intended... they should be denoted as such... like `fallthrough` for `switch` should be normally
* Some of these assume that AWS S3 and MongoLabs are perfectly connected and no issues... bad idea. This is what I was describing. We need [#37](Graceful failure) whether it's a comment, a console message, a page, or some combination of these.
* This doesn't include MongoDB calls that just use `save()` for example... which is not recommended at all. Error traps are good when connecting to third parties whether they are local or remote. I'm not perfect either but I can get easily burned out on fixing these which is why I work in stages instead of all at once. Don't get paid for that! ;) :) Always fill out the arguments if known especially with `aErr`. That's a reason why it's done first in this coding style.
* This was a very brief skim over the code... hopefully it wasn't overzealous or underzealous in code points... but they are comments to be addressed eventually. Living on four hours of sleep in 3 days isn't good so I'm taking a break not to mention a few days away from holiday days.

Applies to #430 and indirectly to #1548

Signed-off-by: Martii <martii@users.noreply.github.com>

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Aug 28, 2020
* Also add a copy of dev DB in both clean state and dirty state. No user/pass included ... currently leave that up to end collaboration since handled via environment variable.

Applies to OpenUserJS#1745 OpenUserJS#37

Refs:
* `mongorestore --gzip --db openuserjs_devel --archive=./dev/devDBdirty.gz`
* `mongodump --gzip --db openuserjs_devel --archive=./dev/devDBclean.gz`
* `CONNECT_STRING=mongodb://127.0.0.1:27017/openuserjs_devel`
Martii added a commit that referenced this issue Aug 28, 2020
* Also add a copy of dev DB in both clean state and dirty state. No user/pass included ... currently leave that up to end collaboration since handled via environment variable.

Applies to #1745 #37

Refs:
* `mongorestore --gzip --db openuserjs_devel --archive=./dev/devDBdirty.gz`
* `mongodump --gzip --db openuserjs_devel --archive=./dev/devDBclean.gz`
* `CONNECT_STRING=mongodb://127.0.0.1:27017/openuserjs_devel`

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Sep 22, 2020
* Better error handling for Write Script Online.
* Better error handling for Upload Script. Fixes potential server trips and/or hangings.
* Repo URL change detected on GH for *formidable*... updated README.md linkage.
* Some symmetry in these areas.

Post OpenUserJS#1730 OpenUserJS#430 OpenUserJS#37
Martii added a commit that referenced this issue Sep 22, 2020
* Better error handling for Write Script Online.
* Better error handling for Upload Script. Fixes potential server trips and/or hangings.
* Repo URL change detected on GH for *formidable*... updated README.md linkage.
* Some symmetry in these areas.

Post #1730 #430 #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Sep 25, 2020
* Catch GH import routine
* Add `#bypass` to statusCodePage

Post OpenUserJS#1731 , applies to OpenUserJS#430 OpenUserJS#37 and closes OpenUserJS#1730
Martii added a commit that referenced this issue Sep 25, 2020
* Catch GH import routine
* Add `#bypass` to statusCodePage

Post #1731 , applies to #430 #37 and closes #1730

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Apr 17, 2021
* Translate GH's 403 to 503
* If/when the dep gets updated, gracefully handle GH's 403 as much as possible at authenticated and non-authenticated requests.
* The *@octokit/auth-token* dep returns lower casings for `authentication` and `basic`... not sure if matching this makes a difference but today I've been getting 45 maximum on unauthenticated GH rate limiting with this. Post OpenUserJS#1729

Applies to OpenUserJS#1705 OpenUserJS#37
Martii added a commit that referenced this issue Apr 17, 2021
* Translate GH's 403 to 503
* If/when the dep gets updated, gracefully handle GH's 403 as much as possible at authenticated and non-authenticated requests.
* The *@octokit/auth-token* dep returns lower casings for `authentication` and `basic`... not sure if matching this makes a difference but today I've been getting 45 maximum on unauthenticated GH rate limiting with this. Post #1729

Applies to #1705 #37

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Apr 17, 2021
* Authentication confirmation doesn't happen at all on object construction. This routine is instead used to store the values for later usage. A call to a URL will show if there is a higher rate limit. In the newer dep `authorization` is calculated as well.
* Clean up and add existence checks in repoManager. Don't necessarily have to terminate the app if API Keys for GH aren't there... should just use lower rate limit... although other features might depend on those values. Appears to be part of the webhook but not confirmed.

Applies to OpenUserJS#1705 OpenUserJS#37  and post OpenUserJS#1729
Martii added a commit that referenced this issue Apr 17, 2021
* Authentication confirmation doesn't happen at all on object construction. This routine is instead used to store the values for later usage. A call to a URL will show if there is a higher rate limit. In the newer dep `authorization` is calculated as well.
* Clean up and add existence checks in repoManager. Don't necessarily have to terminate the app if API Keys for GH aren't there... should just use lower rate limit... although other features might depend on those values. Appears to be part of the webhook but not confirmed.

Applies to #1705 #37  and post #1729

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Apr 21, 2021
* Transform GH 401 to 503 .  Mentioned at https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/ and encountered with newer migrated dep.
* Spec for authorization shows uppercasing... so new dep has it with incorrect casing I believe... may not matter on their server but consistancy here. Reverting.
* Add a few more important comments

Applies to OpenUserJS#1705 OpenUserJS#37 and post OpenUserJS#1799

Ref(s):
* https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8
* https://developer.mozilla.org/docs/Web/HTTP/Authentication
Martii added a commit that referenced this issue Apr 21, 2021
* Transform GH 401 to 503 .  Mentioned at https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/ and encountered with newer *(attempted)* migrated dep.
* Spec for authorization shows uppercasing... so new dep has it with incorrect casing I believe... may not matter on their server but consistancy here. Reverting.
* Add a few more important comments

Applies to #1705 #37 and post #1799

Ref(s):
* https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8
* https://developer.mozilla.org/docs/Web/HTTP/Authentication

Auto-merge
Martii added a commit to Martii/OpenUserJS.org that referenced this issue Dec 8, 2021
* Move generated data from captcha to session if available.
* Completed a few WARNINGs ... tired of looking at those. ;) :)

Post OpenUserJS#944 OpenUserJS#1867 OpenUserJS#37
@Martii Martii mentioned this issue Dec 8, 2021
Martii added a commit that referenced this issue Dec 8, 2021
* Move generated data from captcha to session if available.
* Completed a few WARNINGs ... tired of looking at those. ;) :)

Post #944 #1867 #37

Auto-merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something we do have implemented already but needs improvement upon to the best of knowledge.
Development

No branches or pull requests

2 participants