Overchecking errors [#3 Scary Code] - DEV Community 👩‍💻👨‍💻 Skip to content Navigation menu Search Search Log in Create account DEV Community 👩‍💻👨‍💻 Close DEV Community 👩‍💻👨‍💻 is a community of 916,849 amazing developers We're a place where coders share, stay up-to-date and grow their careers. Create account Log in Home Listings Podcasts Videos Tags FAQ Forem Shop Sponsors About Contact Guides image/svg+xml Software comparisons Other Code of Conduct Privacy Policy Terms of use Twitter Facebook Github Instagram Twitch Like Unicorn Save More... Copy link Copy link Copied to Clipboard Share to Twitter Share to LinkedIn Share to Reddit Share to Hacker News Share to Facebook Share Post via... Report Abuse Bogdan Alexandru Militaru Posted on Nov 7, 2019 • Originally published at boobo94.xyz on Nov 7, 2019 Overchecking errors [#3 Scary Code] #scarycode When I started programming I had a problem trying to overcheck everything, all the errors, and everything. These days I discovered something similar: (typeof err === 'object' && err.status==403) || (typeof err === 'string' && err.substring(0, 15) === 'Not authorized') Firstly why the back-end sends either a string or an object. Secondly 'Not authorized' has only 14 characters, which means the second condition still fails if we suppose that the error thrown by the server starts with Not authorized. Remember, this is a series with scary code, so if you wanna see the complete list, you can do it here. The post Overchecking errors [#3 Scary Code] appeared first on boobo94. Top comments (0) Crown Sort discussion: Selected Sort Option Top Most upvoted and relevant comments will be first Latest Most recent comments will be first Oldest The oldest comments will be first Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Head to your account's Settings to... 🌚 Enable dark mode 🔠 Change your default font 📚 Adjust your experience level to see more relevant content Read next Spring security new Authorization server (0.3.1) - part 1 Nermin Karapandzic - Sep 24 Male Voice Over || DJ & Radio Jingles DJ Sonatty - Sep 24 Killer cross platform pdf reader Talha Aamir - Sep 24 Simple And Easy Way to Deploy React App On GitHub Pages Vibha Mishra - Sep 24 Bogdan Alexandru Militaru Follow Get whatever you want from me [here](https://boobo94.github.io/) Location Bucharest Education Computer Engineering Work Software Engineer Joined Jun 25, 2019 More from Bogdan Alexandru Militaru Scope in scope Angularjs [#2 Scary Code] #scarycode Quote of quotes [#1 Scary Code] #scarycode Once suspended, boobo94 will not be able to comment or publish posts until their suspension is removed. Note: Submit & Suspend Once unsuspended, boobo94 will be able to comment and publish posts again. Note: Submit & Unsuspend Once unpublished, all posts by boobo94 will become hidden and only accessible to themselves. If boobo94 is not suspended, they can still re-publish their posts from their dashboard. Unpublish all posts Once unpublished, this post will become invisible to the public and only accessible to Bogdan Alexandru Militaru. They can still re-publish the post if they are not suspended. Unpublish post Thanks for keeping DEV Community 👩‍💻👨‍💻 safe. Here is what you can do to flag boobo94: Make all posts by boobo94 less visible boobo94 consistently posts content that violates DEV Community 👩‍💻👨‍💻's code of conduct because it is harassing, offensive or spammy. Report other inappropriate conduct Confirm Flag Unflagging boobo94 will restore default visibility to their posts. Confirm Unflag DEV Community 👩‍💻👨‍💻 — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities. Made with love and Ruby on Rails. DEV Community 👩‍💻👨‍💻 © 2016 - 2022. Forem logo We're a place where coders share, stay up-to-date and grow their careers. Log in Create account