MoistCoder / CockyGrabber

C# library for the collection of browser information such as cookies, logins, bookmarks and more
MIT License
144 stars 31 forks source link

App Crashing #46

Closed cuciuu closed 1 year ago

cuciuu commented 1 year ago

image

Error: CockyGrabber.GrabberException: 'The file that stores the key for the decryption of encrypted values (Local State) could not be found: C:\Users\cuciu\AppData\Roaming\Opera Software\Opera Stable\Local State'

Why is it still crashing my app if I got try - catch blocks

try
{
    OperaGxGrabber grabber = new OperaGxGrabber();
    var cookies = await Task.Run(() => grabber.GetCookies());
    foreach(var cookie in cookies)
    {
        string cookieHostname = cookie.HostKey;
        string cookieName = cookie.Name;
        string cookieValue = cookie.DecryptedValue;
        Console.WriteLine($ "{cookie.HostKey}: {cookie.Name} = {cookie.DecryptedValue}");
        if (cookieName.Contains(".ROBLOSECURITY"))
        {}
    }
}
catch (Exception ex)
{
    Console.WriteLine($ "An error occurred: {ex.Message}");
}
MoistCoder commented 1 year ago

Please listen to the to the exception message. It literally tells you that the file is missing.

cuciuu commented 1 year ago

I know the files are missing but why is it crashing my app if I added try - catch blocks? Why isnt it just throwing the error in console

I managed to fix it by adding try - catch blocks here

image

And

image