C
C#RP-1 MVac

❔ I have an API function and I want to know what exception it can throw. How can I do that?

This is not said in the documentation
T
Thinker396d ago
What's an "API function"? Just a method? Other than digging through the source code of the method, there's no way to know what kinda of exceptions it can throw. If you know a method can commonly throw exceptions but you don't know what kind of exceptions and want to be safe, then just do a standard try/catch around it.
E
Esa396d ago
If you're using a modern IDE, you can mouseover the functions name and see what the tooltip states. Properly maintained APIs will use XML docs to list exceptions they might throw, but if they are calling even more functions internally that can throw exceptions, those might not always be listed. I'd use the XML docs as a reference but keep in mind more might happen. YMMV.
A
Accord395d ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
Ambiguity between 2 things idk how to fixGot an error message all of a sudden saying this when everything was working perfect before so i und❔ Problem populating DatagridI'm trying to populate a datagrid where certain columns are populated with information that is read ❔ Avisynth script maker thingIm trying to make a script that creates AVS files for every file in a Directory based on a template.❔ How to work with Hwnd in c#I want to open programs using Process.Start but all those programs have empty MainWindowHandle and M❔ VS For Mac Code CoverageHas anyone figured out how to show which lines are covered after running unit tests in VS For Mac?✅ Run code in main thread after Task.Run completed?Hello, I have a long running void function that I execute in a separate thread by calling `Task.Run(❔ methodHello, If I create a method, does the method know about things in the Main method? Or am I supposed ❔ Project structure1. In my Solution there should be only 1 Project right? Unless its a big App 2. I started using fo❔ how to use EF6 in library with no dependancy injection and no startup.csI used EF core power tools to generate DB Context and reverse engineer the models. now I get an erro❔ HeadFirst Design PatternSo I started with this Book today. First problem starts with the Duck Project: and when he tests h✅ EqualityComparerHello, anyone know of this code work ? --> `EqualityComparer<ICollection<myclass>> .Default.Equals❔ error attaching script (unity)this error appears when trying to attach the script, does anyone know how to solve it?