Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
3 answers
2k views

Math calculation JavaScript. Am I using Objects correctly? Can I use methods / functions to shorten my code further? Also error logging?

Context- CRM system, front-end form. Requirement- Within a form users have to give a rating to a section based on user inputs, each rating has different weighting. The rating is stored in an option ...
BenDev21's user avatar
2 votes
1 answer
180 views

Command handlers in node.js

Description This javascript code uses tmi.js to listen for chat messages in a Twitch chat and perform certain actions depending on their content. In the sample code ...
Patrick Christie's user avatar
2 votes
1 answer
57 views

error tracking in api endpoint

I have built a simple Nuxt 3 app and have some custom api endpoints. I am currently tracking the user query and response statuses to have some insight when something goes wrong and that the app is ...
wittgenstein's user avatar
0 votes
1 answer
352 views

Google App Script Automation for User Onboarding

Background I am a relatively new developer(> 2 years coding) working as an intern for a smaller company, as part of a now 4 person team. We had two other team members, one our system admin and the ...
RankinJ's user avatar
2 votes
0 answers
297 views

JavaScript proxy for better stack traces from external libraries

I've been using the excellent pg-promise library for a few years now, but my primary irk with it is that the stack traces are sometimes unhelpful. For example, the following test will fail (currently ...
BrDaHa's user avatar
  • 133
6 votes
1 answer
1k views

Implementation of exponential backoff algorithm

You can read about the algorithm here. An exponential backoff algorithm retries requests exponentially, increasing the waiting time between retries up to a maximum backoff time. An example is: Make ...
sg7610's user avatar
  • 388
9 votes
3 answers
3k views

Error solution: Uncaught TypeError

Uncaught TypeError: document.getElementById(...) is null I have a single JavaScript file that is connected to multiple pages. The below snippet is a function that is used for a single page. The above ...
user avatar
1 vote
1 answer
60 views

Handling errors in an input based program

I wrote a program which creates a svg-group that contains several arranged rectangles with passages inbetween to reach all of the rectangles inside of an area selected by the user. Each rectangle ...
IceRevenge's user avatar
2 votes
1 answer
526 views

Blocking requests within Express

Is this the correct way to block requests in Express? app.js ...
shorif2000's user avatar
-1 votes
1 answer
1k views

Try-catch-finally snippet [closed]

Using visual studio I created a snippet which helps me surround my already written or new code into a try-catch-finally block. I use axios for REST so there had to be separate error handling method so ...
Suleman's user avatar
  • 169
4 votes
1 answer
1k views

Node.js http retry do while mechanism

I have implemented a simple do/while loop to handle a http request to a third-party. I don’t know when the data I receive will have elements in its array so I retry up to 10 times until the array ...
user195155's user avatar
3 votes
0 answers
26 views

A XMLHttp Request in the browser

Building on a previous answer and an attempt to write a comprehensive XMLHttpRequest example that covers all kinds of possible errors and return them to caller ...
Developer's user avatar
  • 205
0 votes
1 answer
132 views

#Error Handling- Propagating errors to calling function.

Im new to javascript programming and i am required to make a web app. Node.js will be used as the js runtime environment. In order to minimize the amount of time needed for debugging as the app ...
nicholas mitchell's user avatar
1 vote
2 answers
420 views

Function to map letters to numbers

I have a method that converts characters to numbers. It expects a single alphabetical character and returns the equivalent number. For example, if A is provided it returns 1, for B it returns 2. If an ...
Ananda's user avatar
  • 111
1 vote
2 answers
113 views

Error handling for a simple 'fetch some data, then save the data' Node function

This is a fairly simple bit of code: ...
dwjohnston's user avatar
  • 1,348

15 30 50 per page