New answers tagged

2

Handling errors consistently Errors can take the form of a thrown exception, a proper Error object, a plain object, an optional argument to a callback, a Promise, a special return value, a simple string, etc. At some point, all of these have to be converted into some message for the user. How do you convert between all the various forms, where does this ...


0

Http codes has nothing to be with business (validation) errors. Some ppl use HTTP error codes to encode their catatalog of errors. But I don't think it's a good practice. Http errors are related to the protocol (http). So any business exception thrown by your code, should be (in my oponion) handled and returned as a missatge. And of course into a 200 Http ...


2

From the HTTP spec: 10.4.1 400 Bad Request The request could not be understood by the server due to malformed syntax. which doesn't sound quite appropriate for the above scenario. Without know more of what you're doing and your requirements, I would normally bounce invalid user input back via a normal page + 200 status code. If, however, I was supporting ...


1

This is not an anti-pattern. This is a code smell, which is to say that this is the sort of thing you should avoid when it's feasible to do so, but there may be legitimate cases where nothing else does the job. I thought the Promise.all should fail fast. Yup. This is exactly why the default behavior of Promise.all is to fail fast. The rationale ...


0

If I understand correctly, your Question is if and how to check whether // convert to a signed integer modeInt = Convert.ToInt32(modeUint); throws an OverflowException because modeUint = this.myArray[index]; contains an unsigned integer that is too large to fit. I offer the following: Do not check here, because the erroneous data is already loaded ...



Top 50 recent answers are included