linksplatform/Exceptions

Use return of exceptions, instead of implicitly throwing it (throw will be explicit)

Closed this issue · 5 comments

void NotSupportedException() { throw std::logic_error("Not supported exception."); }
auto NotSupportedExceptionAndReturn() { throw std::logic_error("Not supported exception."); }
void NotImplementedException() { throw std::logic_error("Not implemented exception."); }
auto NotImplementedExceptionAndReturn() { throw std::logic_error("Not implemented exception."); }

replace with:

auto NotSupportedException() { return std::logic_error("Not supported exception."); }

auto NotImplementedException() { return std::logic_error("Not implemented exception."); }

use:

throw NotSupportedException();
Checklist
  • cpp/Platform.Exceptions/ThrowExtensions.h ❌ Failed
• Replace the `throw` keyword with `return` in the `NotSupportedException` function definition. The modified function should look like this: `auto NotSupportedException() { return std::logic_error("Not supported exception."); }` • Replace the `throw` keyword with `return` in the `NotImplementedException` function definition. The modified function should look like this: `auto NotImplementedException() { return std::logic_error("Not implemented exception."); }`

Sweep: do

Sweeping

50%


Actions (click)

  • ↻ Restart Sweep

❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred. Try changing the issue description to re-trigger Sweep. If this error persists contact team@sweep.dev.

For bonus GPT-4 tickets, please report this bug on Discord.


Please look at the generated plan. If something looks wrong, please add more details to your issue.

File Path Proposed Changes
cpp/Platform.Exceptions/ThrowExtensions.h Modify cpp/Platform.Exceptions/ThrowExtensions.h with contents:
• Replace the throw keyword with return in the NotSupportedException function definition. The modified function should look like this: auto NotSupportedException() { return std::logic_error("Not supported exception."); }
• Replace the throw keyword with return in the NotImplementedException function definition. The modified function should look like this: auto NotImplementedException() { return std::logic_error("Not implemented exception."); }

🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.

Sweep: in cpp/Platform.Exceptions/ThrowExtensions.h we have code like this:

 void NotSupportedException() { throw std::logic_error("Not supported exception."); } 
  
 auto NotSupportedExceptionAndReturn() { throw std::logic_error("Not supported exception."); } 

Replace throw word in such functions to return

Sweep: retry

Sweep: retry