Click here to Skip to main content
15,881,173 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exceptions Pin
lmoelleb18-Jan-22 4:55
lmoelleb18-Jan-22 4:55 
QuestionRe: Exceptions Pin
Eddy Vluggen18-Jan-22 19:32
professionalEddy Vluggen18-Jan-22 19:32 
AnswerRe: Exceptions Pin
lmoelleb18-Jan-22 20:40
lmoelleb18-Jan-22 20:40 
GeneralRe: Exceptions Pin
Eddy Vluggen19-Jan-22 0:40
professionalEddy Vluggen19-Jan-22 0:40 
GeneralRe: Exceptions Pin
lmoelleb19-Jan-22 0:48
lmoelleb19-Jan-22 0:48 
GeneralRe: Exceptions Pin
Eddy Vluggen19-Jan-22 1:12
professionalEddy Vluggen19-Jan-22 1:12 
AnswerRe: Exceptions Pin
Eddy Vluggen18-Jan-22 18:02
professionalEddy Vluggen18-Jan-22 18:02 
AnswerRe: Exceptions Pin
jschell23-Jan-22 7:32
jschell23-Jan-22 7:32 
Simon_Whale wrote:
list all the exceptions that either the code catches or raises so that I can do a review


That process would need to find that those in all of the libraries that you use also.

Simon_Whale wrote:
reason for the review is the result of a pen test,


Probably because you have an API and you are returning the exception stack trace as part of the API error handling. The solution to that is the following
1. Catch all exceptions so "catch(Exception e)" in your API layer.
2. Log the exception. You should of course already be doing this.
3. Return an error result from the API. Do not return the exception. Probably 500. But over time you can differentiate this in the error handling code.

I would suggest that you also create an id and log that as well and return that as part of the error message. That way you can track an error reported from a caller back to the specific log entry. You can use a GUID but it is going to be more user friendly, especially if a UI is involved, if you create a simple id. It can rotate over time because the context of the error (when reported) is enough to localize in the logs.
Questionnecessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff16-Jan-22 2:39
professionalBillWoodruff16-Jan-22 2:39 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
harold aptroot16-Jan-22 3:21
harold aptroot16-Jan-22 3:21 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff16-Jan-22 5:14
professionalBillWoodruff16-Jan-22 5:14 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
harold aptroot16-Jan-22 6:56
harold aptroot16-Jan-22 6:56 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff16-Jan-22 18:22
professionalBillWoodruff16-Jan-22 18:22 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
Richard Deeming16-Jan-22 22:45
mveRichard Deeming16-Jan-22 22:45 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff18-Jan-22 1:19
professionalBillWoodruff18-Jan-22 1:19 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
Richard Deeming18-Jan-22 1:41
mveRichard Deeming18-Jan-22 1:41 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff18-Jan-22 3:08
professionalBillWoodruff18-Jan-22 3:08 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
Richard Deeming18-Jan-22 6:17
mveRichard Deeming18-Jan-22 6:17 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff19-Jan-22 13:58
professionalBillWoodruff19-Jan-22 13:58 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
Richard Deeming19-Jan-22 21:43
mveRichard Deeming19-Jan-22 21:43 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff20-Jan-22 4:26
professionalBillWoodruff20-Jan-22 4:26 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
harold aptroot16-Jan-22 22:48
harold aptroot16-Jan-22 22:48 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff18-Jan-22 0:49
professionalBillWoodruff18-Jan-22 0:49 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
jschell23-Jan-22 7:40
jschell23-Jan-22 7:40 
GeneralRe: necessity to use .Any() to check if an IEnumerable<T> result has no items without iterating over it ? Pin
BillWoodruff25-Jan-22 3:58
professionalBillWoodruff25-Jan-22 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.