SA-MP Forums Archive
[Include] try-catch for not-implemented features - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] try-catch for not-implemented features (/showthread.php?tid=665770)



try-catch for not-implemented features - Slice - 15.04.2019

This brings a solution to a rather common problem we had for years.

A very common problem:
Code:
stock MyFunc() {
    ObviousFeatureThatDoesNotExist();
}

stock ObviousFeatureThatDoesNotExist() {
    throw new NotImplementedInSampException();
}
Result: uncaught exception

Code:
stock ΟpenМp() {
    try {
        MyFunc();
    } catch (ObviousFeatureThatDoesNotExist e) {
        ImplementFeature(e);
    }
Result: the feature becomes implemented


Re: try-catch for not-implemented features - denNorske - 15.04.2019

Hi sweedish neighbour.

mp is an object of open btw..


Re: try-catch for not-implemented features - MicroKyrr - 15.04.2019

Woah, this code is revolutionary! Very cool. Who would have thought that the solution to this problem was really simple :O

Said my brain on drugs lmao.


Re: try-catch for not-implemented features - Slice - 15.04.2019

Thank you


Re: try-catch for not-implemented features - MicroKyrr - 15.04.2019

Quote:
Originally Posted by Slice
View Post
Thank you
Hello sir, I received this error

Code:
Error 069: Feature denied