tlog icon indicating copy to clipboard operation
tlog copied to clipboard

Implement error handling macros

Open spbnick opened this issue 7 years ago • 7 comments

Throughout the code several error-handling patterns are repeated many times. Implement macros to handle the most typical cases and save on line count.

spbnick avatar Aug 25 '17 12:08 spbnick

Hi Nick, could you write some example about error-handling patterns are repeated in code?

danghai avatar Dec 10 '17 22:12 danghai

Hi Hai, Here is one which is repeated often: https://github.com/Scribery/tlog/blob/master/src/tlog-rec.c#L67-L69 Here is another which can be implemented as the previous one: https://github.com/Scribery/tlog/blob/master/src/tlog-rec.c#L85-L87 And another: https://github.com/Scribery/tlog/blob/master/src/tlog-play.c#L130-L132

Look around and you'll find some that are repeating.

spbnick avatar Dec 11 '17 17:12 spbnick

Hi Nick, before doing that, do you want to add line, function, file ( the same debug output) into stack err? It is convenient because when you have many error in stack, it will report information about them for you.

danghai avatar Dec 11 '17 17:12 danghai

We can do that later. I'd rather not add that yet, as there wasn't much need for it so far, and it would increase the code size.

spbnick avatar Dec 11 '17 18:12 spbnick

Hi Nick, I see there are 4 different types repeated. Should I write 4 function in Header to handle them? 1. pushf 2. pushs 3. pushc, then pushf 4. pushc, then pushs What do you think?

danghai avatar Dec 15 '17 07:12 danghai

I think I'll be able to understand you better, if I just saw the code you want to write :) Just make a PR with the macros you want to add and then let's discuss it.

spbnick avatar Dec 18 '17 17:12 spbnick

Hi Nick, I should write more specific about the code :). I send the first draft to new pull request for this issue.

danghai avatar Dec 20 '17 09:12 danghai